com.github.seanroy.plugins..DeployLambdaMojo.swp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lambda-maven-plugin Show documentation
Show all versions of lambda-maven-plugin Show documentation
A maven plugin that deploys functions to AWS Lambda
b0VIM 7.4 t|+X)?$P sean sean-Gazelle-Professional ~sean/workspace/lambda-maven-plugin/src/main/java/com/github/seanroy/plugins/DeployLambdaMojo.java
3210 #"! U tp S ????????A T ????????: ? ????????0 ? ????????5 ? ????????> 4 % r ad G ? S ? ? ? ? 3 ? ? b % ?
?
i
;
? ? V ? ? t =
?
?
?
?
?
r
L
%
? ? e 8 ? ? E A # ? ? ? ? ? x [ + ? ? ? i / ? ? ? ? ? ? e ? ? : ? ? n 4 ? ? ? ? ? ? : ? ? ? if (!isConfigurationChanged) { boolean isConfigurationChanged = isConfigurationChanged(lambdaFunction, getFunctionResult); private boolean shouldUpdate(LambdaFunction lambdaFunction, GetFunctionResult getFunctionResult) { } return null; } .apply(lambdaFunction); .andThen(createOrUpdateTriggers) createFunction.andThen(createOrUpdateAliases) } catch (ResourceNotFoundException ignored) { .apply(lambdaFunction)); .andThen(createOrUpdateTriggers) .andThen(createOrUpdateAliases) updateFunctionCode.andThen(updateFunctionConfig) .map(getFunctionResult -> .filter(getFunctionResult -> shouldUpdate(lambdaFunction, getFunctionResult)) of(getFunction(lambdaFunction)) try { private Void createOrUpdate(LambdaFunction lambdaFunction) { } } throw new MojoExecutionException(e.getMessage()); getLog().error("Error during processing", e); } catch (Exception e) { }).forEach(this::createOrUpdate); return f; getLog().info("---- Create or update " + f.getFunctionName() + " -----"); lambdaFunctions.stream().map(f -> { uploadJarToS3(); try { super.execute(); public void execute() throws MojoExecutionException { @Override public class DeployLambdaMojo extends AbstractLambdaMojo { @Mojo(name = "deploy-lambda") */ * @author Sean N. Roy, Krzysztof Grodzicki 11/08/16. * * I am a deploy mojo responsible to upload and create or update lambda function in AWS. /** import static java.util.stream.Collectors.toList; import static java.util.Optional.ofNullable; import static java.util.Optional.of; import static java.util.Optional.empty; import static com.amazonaws.services.lambda.model.EventSourcePosition.LATEST; import java.util.function.Function; import java.util.function.BiPredicate; import java.util.function.BiFunction; import java.util.UUID; import java.util.Optional; import java.util.Objects; import java.util.List; import java.io.FileInputStream; import java.io.File; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.commons.codec.digest.DigestUtils; import com.amazonaws.services.sns.model.SubscribeResult; import com.amazonaws.services.sns.model.SubscribeRequest; import com.amazonaws.services.sns.model.CreateTopicResult; import com.amazonaws.services.sns.model.CreateTopicRequest; import com.amazonaws.services.s3.model.PutObjectResult; import com.amazonaws.services.s3.model.ObjectMetadata; import com.amazonaws.services.s3.model.AmazonS3Exception; import com.amazonaws.services.lambda.model.*; import com.amazonaws.services.dynamodbv2.model.Stream; import com.amazonaws.services.dynamodbv2.model.ListStreamsResult; import com.amazonaws.services.dynamodbv2.model.ListStreamsRequest; import com.amazonaws.services.cloudwatchevents.model.Target; import com.amazonaws.services.cloudwatchevents.model.PutTargetsRequest; import com.amazonaws.services.cloudwatchevents.model.PutRuleResult; import com.amazonaws.services.cloudwatchevents.model.PutRuleRequest; import com.amazonaws.services.cloudwatchevents.model.ListRuleNamesByTargetRequest; import com.amazonaws.auth.policy.Statement; import com.amazonaws.auth.policy.Policy; package com.github.seanroy.plugins; ad
?
% ? ? ? m ? ? ? ~ k H & ?
?
?
?
d
? ? ? ? z l + ? ? ? ? ? ? V ?
?
?
?
?
?
} } return s3Bucket; } getLog().info("Created bucket s3://" + s3Client.createBucket(s3Bucket).getName()); if (s3Client.listBuckets().stream().noneMatch(p -> p.getName().equals(s3Bucket))) { private String getBucket() { } } return null; } catch (AmazonS3Exception ignored) { return s3Client.getObjectMetadata(bucket, fileName); try { private ObjectMetadata getObjectMetadata(String bucket) { } return putObjectResult; getLog().info("Upload complete..."); PutObjectResult putObjectResult = s3Client.putObject(s3Bucket, fileName, file); getLog().info("Uploading " + functionCode + " to AWS S3 bucket " + s3Bucket); private PutObjectResult upload(File file) { } }); return true; upload(file); .orElseGet(() -> { }) return null; // file should be imported } return true; getLog().info(fileName + " is up to date in AWS S3 bucket " + s3Bucket + ". Not uploading..."); if (isTheSame) { .map(isTheSame -> { }) return localmd5.equals(remoteMD5);
© 2015 - 2025 Weber Informatics LLC | Privacy Policy