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

项目:java-translatebot    文件:OauthHandlerDeployer.java   
private void deleteFunction() {

        final DeleteFunctionRequest dlfrq = new DeleteFunctionRequest().withFunctionName(FunctionName);
        try {
            this.awsLambdaClient.deleteFunction(dlfrq);
        } catch (final ResourceNotFoundException rnfx) {
            // it is ok if the resource is not there, we simply succeed
        }

    }
项目:aws-lambda-jenkins-plugin    文件:LambdaDeployServiceTest.java   
private void setFunctionFound(Boolean found){
    if(found) {
        when(awsLambdaClient.getFunction(any(GetFunctionRequest.class)))
                .thenReturn(new GetFunctionResult());
    } else {
        when(awsLambdaClient.getFunction(any(GetFunctionRequest.class)))
                .thenThrow(new ResourceNotFoundException(""));
    }
}
项目:aws-lambda-jenkins-plugin    文件:LambdaDeployServiceTest.java   
private void setAlias(String alias, Boolean exists){
    this.createAlias = Boolean.TRUE;
    this.alias = alias;

    GetAliasResult getAliasResult = new GetAliasResult()
            .withName(alias)
            .withFunctionVersion(functionVersion);
    if(exists){
        when(awsLambdaClient.getAlias(any(GetAliasRequest.class)))
                .thenReturn(getAliasResult);
    } else {
        when(awsLambdaClient.getAlias(any(GetAliasRequest.class)))
                .thenThrow(new ResourceNotFoundException(""));
    }

    CreateAliasResult createAliasResult = new CreateAliasResult()
            .withName(alias)
            .withFunctionVersion(functionVersion);
    when(awsLambdaClient.createAlias(any(CreateAliasRequest.class)))
            .thenReturn(createAliasResult);

    UpdateAliasResult updateAliasResult = new UpdateAliasResult()
            .withName(alias)
            .withFunctionVersion(functionVersion);
    when(awsLambdaClient.updateAlias(any(UpdateAliasRequest.class)))
            .thenReturn(updateAliasResult);
}