Class AwsLambdaCustomRuntime

java.lang.Object
io.micronaut.starter.feature.awslambdacustomruntime.AwsLambdaCustomRuntime
All Implemented Interfaces:
io.micronaut.core.naming.Described, io.micronaut.core.naming.Named, io.micronaut.core.order.Ordered, Feature, OpenRewriteFeature, ApplicationFeature, AwsCloudFeature, CloudFeature, FunctionFeature

@Requires(property="micronaut.starter.feature.aws.lambda.custom.runtime.enabled", value="true", defaultValue="true") @Singleton public class AwsLambdaCustomRuntime extends Object implements FunctionFeature, ApplicationFeature, AwsCloudFeature, OpenRewriteFeature
Feature that adds support for deploying Micronaut Functions using a custom AWS Lambda runtime. Ensures necessary AWS Lambda and HTTP client features are included.
  • Field Details

    • DEPENDENCY_AWS_FUNCTION_AWS_CUSTOM_RUNTIME

      public static final Dependency DEPENDENCY_AWS_FUNCTION_AWS_CUSTOM_RUNTIME
    • MAIN_CLASS_NAME

      public static final String MAIN_CLASS_NAME
      See Also:
    • FEATURE_NAME_AWS_LAMBDA_CUSTOM_RUNTIME

      public static final String FEATURE_NAME_AWS_LAMBDA_CUSTOM_RUNTIME
      See Also:
  • Constructor Details

    • AwsLambdaCustomRuntime

      public AwsLambdaCustomRuntime(jakarta.inject.Provider<AwsLambda> awsLambda, HttpClientJdk httpClientJdk)
  • Method Details

    • processSelectedFeatures

      public void processSelectedFeatures(FeatureContext featureContext)
      Processes selected features and ensures required AWS Lambda and HTTP client features are present.
      Specified by:
      processSelectedFeatures in interface Feature
      Parameters:
      featureContext - The feature context to modify.
    • getName

      @NonNull public @NonNull String getName()
      Description copied from interface: Feature
      The name of the feature. It must be unique.
      Specified by:
      getName in interface Feature
      Specified by:
      getName in interface io.micronaut.core.naming.Named
      Returns:
      the name of the feature
    • isVisible

      public boolean isVisible()
      Description copied from interface: Feature
      Some features should not be visible to the user because they are a common parent of other selectable features, or they should always be applied, or any other reason.
      Specified by:
      isVisible in interface ApplicationFeature
      Specified by:
      isVisible in interface Feature
      Returns:
      True if the feature should be able to be selected by the user
    • getTitle

      public String getTitle()
      Specified by:
      getTitle in interface Feature
      Returns:
      The title of the feature
    • getDescription

      @NonNull public @NonNull String getDescription()
      Specified by:
      getDescription in interface io.micronaut.core.naming.Described
      Specified by:
      getDescription in interface Feature
    • apply

      public void apply(GeneratorContext generatorContext)
      Applies the AWS Lambda Custom Runtime feature to the generator context by adding required dependencies, templates, and configuration settings.
      Specified by:
      apply in interface ApplicationFeature
      Specified by:
      apply in interface Feature
      Specified by:
      apply in interface OpenRewriteFeature
      Parameters:
      generatorContext - The context of the generator to apply this feature to.
    • shouldGenerateMainClassForRuntime

      public boolean shouldGenerateMainClassForRuntime(GeneratorContext generatorContext)
      Determines if the FunctionLambdaRuntime main class should be generated.
      Parameters:
      generatorContext - The generator context.
      Returns:
      true if the main class should be generated, false otherwise.
    • mainClassName

      @Nullable public @Nullable String mainClassName(GeneratorContext generatorContext)
      Returns the fully qualified main class name to use for AWS Lambda custom runtime, based on the application type and features.
      Specified by:
      mainClassName in interface ApplicationFeature
      Parameters:
      generatorContext - The generator context.
      Returns:
      The main class name to use.
      Throws:
      io.micronaut.context.exceptions.ConfigurationException - if AWS Lambda feature is missing.
    • getCategory

      public String getCategory()
      Specified by:
      getCategory in interface Feature
      Specified by:
      getCategory in interface FunctionFeature
      Returns:
      The Category to which the feature belongs to.
    • getRecipes

      public List<String> getRecipes(GeneratorContext generatorContext)
      Specified by:
      getRecipes in interface OpenRewriteFeature