/// <summary>
        /// Factory method to create a runtime specific lambda packager.
        /// </summary>
        /// <param name="lambdaArtifact">The lambda artifact to package</param>
        /// <param name="s3">Interface to S3</param>
        /// <param name="logger">Interface to logger.</param>
        /// <param name="platform">Operating system platform</param>
        /// <returns>Runtime specific subclass of <see cref="LambdaPackager"/></returns>
        public static LambdaPackager CreatePackager(
            LambdaArtifact lambdaArtifact,
            IPSS3Util s3,
            ILogger logger,
            IOSInfo platform)
        {
            if (lambdaArtifact == null)
            {
                throw new ArgumentNullException(nameof(lambdaArtifact));
            }

            // To package dependencies, the lambda must be of a supported runtime.
            // ReSharper disable once SwitchStatementHandlesSomeKnownEnumValuesWithDefault - Intentionally so.
            switch (lambdaArtifact.RuntimeInfo.RuntimeType)
            {
            case LambdaRuntimeType.Node:

                return(new LambdaNodePackager(lambdaArtifact, s3, logger));

            case LambdaRuntimeType.Python:

                // Python treats Linux and OSX the same so if not Windows, then Linux packager
                return(platform.OSPlatform == OSPlatform.Windows
                               ? (LambdaPythonPackager) new LambdaPythonPackagerWindows(lambdaArtifact, s3, logger)
                               : new LambdaPythonPackagerLinux(lambdaArtifact, s3, logger));

            case LambdaRuntimeType.Ruby:

                return(new LambdaRubyPackager(lambdaArtifact, s3, logger));

            default:

                logger.LogWarning(
                    $"Dependency packaging for lambda runtime '{lambdaArtifact.RuntimeInfo.RuntimeType}' is currently not supported.");
                return(new LambdaPlainPackager(lambdaArtifact, s3, logger));
            }
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LambdaPythonPackagerWindows"/> class.
 /// </summary>
 /// <param name="lambdaArtifact">The lambda artifact to package</param>
 /// <param name="s3">Interface to S3</param>
 /// <param name="logger">Interface to logger.</param>
 public LambdaPythonPackagerWindows(LambdaArtifact lambdaArtifact, IPSS3Util s3, ILogger logger)
     : base(lambdaArtifact, s3, logger)
 {
 }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LambdaPlainPackager"/> class.
 /// </summary>
 /// <param name="lambdaArtifact">The lambda artifact to package</param>
 /// <param name="s3">Interface to S3</param>
 /// <param name="logger">Interface to logger.</param>
 public LambdaPlainPackager(LambdaArtifact lambdaArtifact, IPSS3Util s3, ILogger logger)
     : base(lambdaArtifact, s3, logger)
 {
 }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LambdaPythonPackager"/> class.
 /// </summary>
 /// <param name="lambdaArtifact">The lambda artifact to package</param>
 /// <param name="s3">Interface to S3</param>
 /// <param name="logger">Interface to logger.</param>
 protected LambdaPythonPackager(LambdaArtifact lambdaArtifact, IPSS3Util s3, ILogger logger)
     : base(lambdaArtifact, s3, logger)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LambdaPackager"/> class.
 /// </summary>
 /// <param name="lambdaArtifact">The lambda artifact to package</param>
 /// <param name="s3">Interface to S3</param>
 /// <param name="logger">Interface to logger.</param>
 protected LambdaPackager(LambdaArtifact lambdaArtifact, IPSS3Util s3, ILogger logger)
 {
     this.LambdaArtifact = lambdaArtifact;
     this.Logger         = logger;
     this.S3             = s3;
 }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LambdaSiblingModulePackager"/> class.
 /// </summary>
 /// <param name="lambdaArtifact">The lambda artifact to package</param>
 /// <param name="s3">Interface to S3</param>
 /// <param name="logger">Interface to logger.</param>
 protected LambdaSiblingModulePackager(LambdaArtifact lambdaArtifact, IPSS3Util s3, ILogger logger)
     : base(lambdaArtifact, s3, logger)
 {
 }