-
Notifications
You must be signed in to change notification settings - Fork 453
Conversation
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.
looks really useful as we discussed on IRC.
Some minor comments, but @geomacy your impl is even cleaner than expected using the annotation.
Thanks!
@@ -101,7 +105,25 @@ | |||
this.serviceAndRegion = serviceAndRegion; | |||
} | |||
|
|||
@Override public HttpRequest filter(HttpRequest request) throws HttpException { | |||
private String getAnnotatedApiVersion(HttpRequest request) { |
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.
[minor] Although private could you make return Optional<String>
instead of null ?
@Target({ METHOD }) | ||
@Retention(RUNTIME) | ||
@Qualifier | ||
public @interface ApiVersionOverride { |
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.
I like this idea, although maybe ARM approach -- which is meant to solve the same issue -- is slightly more flexible as you can configure the version without re-building the project.
Anyway I think it is really unlikely that a new version would not require a change at level of java implementation, so I think the Annotation is sensible here.
@nacx any further comments?
* @param options The options containing the attribute to modify. You can only modify one attribute at a time. | ||
* @return true if the modification was successful | ||
*/ | ||
@ApiVersionOverride("2014-06-15") |
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.
neat, I like it!
I think we should edit the FormSignerV2 as well |
I like the annotation approach and agree that the flexibility needed in ARM, where they deploy new versions of the APIs quite often (but keeping backward compatibility) might not be needed here. A couple questions:
|
I can add the annotation at class level. I originally started using |
Unit tests may fail because they hardcode the expected version. Live tests will tell us if the change is safe. Let's run them for the classes that use the annotation. |
Updates made. I was able to switch to using By the way how is the |
Good! Have you been able to run the live tests for the affected APIs?
The default value is taken from the metadata. It can be overridden when creating the context, and it is configured and bound in a Guice module when creating the context. |
hi @nacx thanks for the explanation of the wiring. I've tried to run live tests, but may not be set up for it - the tests that have
I can run I've tried running
When running the Chef tests I get errors complaining about I haven't tried the tests in Have you any links to info that I might be able to use to get those ec2 tests going? |
p.s. I have checked the same tests as above in |
I don't know why it raises that unauthorized error. I tried with my account with the same results. |
Ah, so it's something to do with the tests themselves then, not just my environment being wrong? I take it you get the error in |
Yes. Something to investigate. But I'd rather keep this PR on hold for a while, just to make sure auth failures don't come (apart from other things) from signature issues? |
@nacx ok; I'll try to take a look at the tests to see if I can contribute anything to a fix. I'd be keen to get this merged so I can start using it. |
The intention is to use @SinceApiVersion for this purpose, but that would affect a number of APIs, and we would want to have good test coverage before merging that change (in FormSignerUtils#getAnnotatedApiVersion). However, there is some issue wth certain tests at resent that means we cannot successfully test all APIs that make use of @SinceApiVersion in order to assure ourselves that FormSignerUtils will not introduce some problem. See jclouds#1102 (comment) for details. This annotation is introduced as a temporary measure in order to decouple the functionality of FormSignerUtils#getAnnotatedApiVersion from @SinceApiVersion and the tests in question. It can be removed and replaced by @SinceApiVersion when those tests are fixed. Designates that a method overrides the {@link ApiVersion} on the class with a specific value.
70860c7
to
59f593a
Compare
hi @nacx, per our conversation on IRC I have reverted to using a custom annotation, but put a comment on it explaining that it is meant only as a temporary measure to decouple the new function in I have squashed the other commits from this PR into one, and left the custom annotation as a separate commit, so that it's easy to tell it apart, and hopefully even just revert it when the tests are working again. How do you think that looks? |
p.s. I tested the Live tests for AWSEC2SubnetApi again successfully with this, as well as the mock tests |
Thanks, @geomacy! I've merged it to master and 2.0.x. |
The intention is to use @SinceApiVersion for this purpose, but that would affect a number of APIs, and we would want to have good test coverage before merging that change (in FormSignerUtils#getAnnotatedApiVersion). However, there is some issue wth certain tests at resent that means we cannot successfully test all APIs that make use of @SinceApiVersion in order to assure ourselves that FormSignerUtils will not introduce some problem. See #1102 (comment) for details. This annotation is introduced as a temporary measure in order to decouple the functionality of FormSignerUtils#getAnnotatedApiVersion from @SinceApiVersion and the tests in question. It can be removed and replaced by @SinceApiVersion when those tests are fixed. Designates that a method overrides the {@link ApiVersion} on the class with a specific value.
The intention is to use @SinceApiVersion for this purpose, but that would affect a number of APIs, and we would want to have good test coverage before merging that change (in FormSignerUtils#getAnnotatedApiVersion). However, there is some issue wth certain tests at resent that means we cannot successfully test all APIs that make use of @SinceApiVersion in order to assure ourselves that FormSignerUtils will not introduce some problem. See #1102 (comment) for details. This annotation is introduced as a temporary measure in order to decouple the functionality of FormSignerUtils#getAnnotatedApiVersion from @SinceApiVersion and the tests in question. It can be removed and replaced by @SinceApiVersion when those tests are fixed. Designates that a method overrides the {@link ApiVersion} on the class with a specific value.
This is a follow-up to #1091 (comment).
This PR adds the capability to modify the subnet to auto-assign the public IP via
ModifySubnetAttribute
.It turned out that the
ModifySubnetAttribute
is a method that has been added to the AWS API subsequent to the version2012-06-01
of the other subnet methods; to allow the selective specification of a different version I am proposing in this PR the introduction of a new annotationApiVersionOverride
, q.v. and see its use in https://github.com/jclouds/jclouds/compare/master...geomacy:modify-subnet-attribute?expand=1#diff-aa0b3b1bb310c30b9f8fdbab82794412R145The annotation is processed by
FormSignerV4
; should I do this inFormSignerV2
as well?