private static synchronized String getLambdaName(String service) { String lambdaName = serviceAndNametoLambdaName.get(service); if (lambdaName == null) { AWSLambdaClient lambdaClient = new AWSLambdaClient(); ListFunctionsResult lambdas = lambdaClient.listFunctions(); for (FunctionConfiguration lambda : lambdas.getFunctions()) { log.info("Have lambda with name {}", lambda.getFunctionName()); String[] components = lambda.getFunctionName().split("\\-"); if (components.length > 1) { // lambda format // stack-function-random serviceAndNametoLambdaName.put(components[1], lambda.getFunctionName()); } } } lambdaName = serviceAndNametoLambdaName.get(service); log.info("am returning {} for lambda with name {}", lambdaName, service); return lambdaName; }
private boolean needsConfigurationUpdate(GetFunctionResult getFunctionRes, String functionName, String handlerMethod) { boolean needsReDeploy = true; FunctionConfiguration conf = getFunctionRes.getConfiguration(); if (conf.getHandler().equals(handlerMethod)) { if (conf.getMemorySize().equals(memory)) { if (conf.getRole().equals(lambdaRoleARN)) { if (conf.getTimeout().equals(handlerTimeout)) { needsReDeploy = false; } else { warnReDeploy(functionName, "timeout", String.valueOf(conf.getTimeout()), String.valueOf(handlerTimeout)); } } else { warnReDeploy(functionName, "role", conf.getRole(), lambdaRoleARN); } } else { warnReDeploy(functionName, "memory", String.valueOf(conf.getMemorySize()), String.valueOf(memory)); } } else { warnReDeploy(functionName, "handler method", conf.getHandler(), handlerMethod); } return needsReDeploy; }
public FunctionEntry(FunctionConfiguration configuration) { functionName = configuration.getFunctionName(); runtime = Runtime.fromValue(configuration.getRuntime()); handler = configuration.getHandler(); }