Java 类com.amazonaws.services.lambda.model.UpdateFunctionConfigurationRequest 实例源码

项目:aws-lambda-deploy    文件:AWSLambdaDeployer.java   
private String updateLambdaConfiguration(AWSLambdaClient lambdaClient,
        String functionName, String description, String handlerMethod) {

    UpdateFunctionConfigurationRequest request = new UpdateFunctionConfigurationRequest();
    request.setDescription(description);
    request.setFunctionName(functionName);
    request.setHandler(handlerMethod);
    request.setMemorySize(memory);
    request.setRole(lambdaRoleARN);
    request.setTimeout(handlerTimeout);

    UpdateFunctionConfigurationResult result = lambdaClient
            .updateFunctionConfiguration(request);

    return result.getFunctionArn();
}
项目:aws-lambda-jenkins-plugin    文件:LambdaDeployServiceTest.java   
private void calledUpdateConfiguration(Boolean called){
    if(called){
        ArgumentCaptor<UpdateFunctionConfigurationRequest> args = ArgumentCaptor.forClass(UpdateFunctionConfigurationRequest.class);
        verify(awsLambdaClient, times(1)).updateFunctionConfiguration(args.capture());
        UpdateFunctionConfigurationRequest expected = new UpdateFunctionConfigurationRequest()
                .withDescription(description)
                .withFunctionName(functionName)
                .withHandler(handler)
                .withMemorySize(memory)
                .withRole(role)
                .withRuntime(runtime)
                .withVpcConfig(new VpcConfig().withSubnetIds(subnets).withSecurityGroupIds(securityGroups))
                .withTimeout(timeout)
                .withKMSKeyArn(kmsArn)
                .withEnvironment(new Environment().withVariables(environment))
                .withDeadLetterConfig(new DeadLetterConfig().withTargetArn(deadLetterQueueArn));

        assertEquals(expected, args.getValue());

    } else {
        verify(awsLambdaClient, never()).updateFunctionConfiguration(any(UpdateFunctionConfigurationRequest.class));
    }
}
项目:aws-lambda-jenkins-plugin    文件:LambdaDeployServiceTest.java   
@Before
public void setUp() throws Exception {
    description = "description";
    functionName = "function";
    handler = "function.handler";
    memory = 1024;
    role = "role";
    runtime = "nodejs";
    publish = Boolean.FALSE;
    functionVersion = null;
    createAlias = Boolean.FALSE;
    alias = null;
    timeout = 30;
    subnets = new ArrayList<>();
    securityGroups = new ArrayList<>();
    kmsArn = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012";
    environment = new HashMap<>();
    environment.put("key", "value");
    deadLetterQueueArn = "arn:aws:sqs:us-east-1:123456789012:queueName";
    lambdaDeployService = new LambdaDeployService(awsLambdaClient, jenkinsLogger);
    when(awsLambdaClient.updateFunctionConfiguration(any(UpdateFunctionConfigurationRequest.class)))
            .thenReturn(new UpdateFunctionConfigurationResult());
    when(awsLambdaClient.updateFunctionCode(any(UpdateFunctionCodeRequest.class)))
            .thenReturn(new UpdateFunctionCodeResult());
    when(awsLambdaClient.createFunction(any(CreateFunctionRequest.class)))
            .thenReturn(new CreateFunctionResult());
}