Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 48
Fixing CallChain to be easier to use for consistent pattern to use#242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -62,6 +62,7 @@ | ||
| import software.amazon.cloudformation.proxy.CallbackAdapter; | ||
| import software.amazon.cloudformation.proxy.CloudFormationCallbackAdapter; | ||
| import software.amazon.cloudformation.proxy.Credentials; | ||
| import software.amazon.cloudformation.proxy.DelayFactory; | ||
| import software.amazon.cloudformation.proxy.HandlerErrorCode; | ||
| import software.amazon.cloudformation.proxy.HandlerRequest; | ||
| import software.amazon.cloudformation.proxy.LoggerProxy; | ||
| @@ -126,7 +127,7 @@ protected LambdaWrapper() { | ||
| this.typeReference = getTypeReference(); | ||
| } | ||
| /** | ||
| /* | ||
| * This .ctor provided for testing | ||
| */ | ||
| public LambdaWrapper(final CallbackAdapter<ResourceT> callbackAdapter, | ||
| @@ -385,7 +386,8 @@ public void handleRequest(final InputStream inputStream, final OutputStream outp | ||
| if (request.getRequestData().getCallerCredentials() != null) { | ||
| awsClientProxy = new AmazonWebServicesClientProxy(requestContext == null, this.loggerProxy, | ||
| request.getRequestData().getCallerCredentials(), | ||
| () -> (long) context.getRemainingTimeInMillis()); | ||
| () -> (long) context.getRemainingTimeInMillis(), | ||
| DelayFactory.CONSTANT_DEFAULT_DELAY_FACTORY); | ||
| } | ||
| boolean computeLocally = true; | ||
| @@ -600,14 +602,24 @@ protected abstract ResourceHandlerRequest<ResourceT> transform(HandlerRequest<Re | ||
| /** | ||
| * Implemented by the handler package as the key entry point. | ||
| * | ||
| * @param proxy Amazon webservice proxy to inject credentials correctly. | ||
| * @param request incoming request for the call | ||
| * @param action which action to take {@link Action#CREATE}, | ||
| * {@link Action#DELETE}, {@link Action#READ} {@link Action#LIST} or | ||
| * {@link Action#UPDATE} | ||
| * @param callbackContext the callback context to handle reentrant calls | ||
| * @return progress event indicating success, in progress with delay callback or | ||
| * failed state | ||
| * @throws Exception propagate any unexpected errors | ||
| */ | ||
| public abstract ProgressEvent<ResourceT, CallbackT> invokeHandler(AmazonWebServicesClientProxy proxy, | ||
| ResourceHandlerRequest<ResourceT> request, | ||
| Action action, | ||
| CallbackT callbackContext) | ||
| throws Exception; | ||
| /** | ||
| /* | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ? ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above | ||
| * null-safe exception metrics delivery | ||
| */ | ||
| private void publishExceptionMetric(final Action action, final Throwable ex, final HandlerErrorCode handlerErrorCode) { | ||
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* | ||
| * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"). | ||
| * You may not use this file except in compliance with the License. | ||
| * A copy of the License is located at | ||
| * | ||
| * http://aws.amazon.com/apache2.0 | ||
| * | ||
| * or in the "license" file accompanying this file. This file is distributed | ||
| * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
| * express or implied. See the License for the specific language governing | ||
| * permissions and limitations under the License. | ||
| */ | ||
| package software.amazon.cloudformation.proxy; | ||
| import java.time.Duration; | ||
| import software.amazon.cloudformation.proxy.delay.Constant; | ||
| @FunctionalInterface | ||
| public interface DelayFactory { | ||
| DelayFactory CONSTANT_DEFAULT_DELAY_FACTORY = (apiCall, incoming) -> incoming != null | ||
| ? incoming | ||
| : Constant.of().delay(Duration.ofSeconds(5)).timeout(Duration.ofMinutes(20)).build(); | ||
| Delay getDelay(String apiCall, Delay provided); | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't JavaDoc comment meant to start with
/**? (There's a few of these changes in this PR)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason the comment kept failing on travis but successful locally. Will try to give it another shot.