diff --git a/apis/sts/src/main/java/org/jclouds/aws/filters/FormSignerUtils.java b/apis/sts/src/main/java/org/jclouds/aws/filters/FormSignerUtils.java index 84ff04b45e..4a5d6d626c 100644 --- a/apis/sts/src/main/java/org/jclouds/aws/filters/FormSignerUtils.java +++ b/apis/sts/src/main/java/org/jclouds/aws/filters/FormSignerUtils.java @@ -18,7 +18,7 @@ package org.jclouds.aws.filters; import org.jclouds.http.HttpRequest; import org.jclouds.reflect.Invocation; -import org.jclouds.rest.annotations.SinceApiVersion; +import org.jclouds.rest.annotations.ApiVersionOverride; import org.jclouds.rest.internal.GeneratedHttpRequest; import com.google.common.base.Optional; @@ -32,7 +32,7 @@ public final class FormSignerUtils { private FormSignerUtils() {} /** - * Get the version from a @SinceApiVersion() annotation on an API method or its owning class. + * Get the version from a @ApiVersionOverride() annotation on an API method or its owning class. * @param request The API request for the method. * @return An optional of the value of the annotation. */ @@ -47,12 +47,12 @@ public final class FormSignerUtils { private static Optional getAnnotatedApiVersion(Invocation invocation) { final Invokable invokable = invocation.getInvokable(); - if (invokable.isAnnotationPresent(SinceApiVersion.class)) { - return Optional.fromNullable(invokable.getAnnotation(SinceApiVersion.class).value()); + if (invokable.isAnnotationPresent(ApiVersionOverride.class)) { + return Optional.fromNullable(invokable.getAnnotation(ApiVersionOverride.class).value()); } else { final Class owner = invokable.getOwnerType().getRawType(); - if (owner.isAnnotationPresent(SinceApiVersion.class)) { - return Optional.fromNullable(owner.getAnnotation(SinceApiVersion.class).value()); + if (owner.isAnnotationPresent(ApiVersionOverride.class)) { + return Optional.fromNullable(owner.getAnnotation(ApiVersionOverride.class).value()); } } return Optional.absent(); diff --git a/core/src/main/java/org/jclouds/rest/annotations/ApiVersionOverride.java b/core/src/main/java/org/jclouds/rest/annotations/ApiVersionOverride.java new file mode 100644 index 0000000000..0307806b5e --- /dev/null +++ b/core/src/main/java/org/jclouds/rest/annotations/ApiVersionOverride.java @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License 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 org.jclouds.rest.annotations; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import javax.inject.Qualifier; + + +/** + * @Deprecated 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 {@link FormSignerUtils#getAnnotatedApiVersion}). However, there is some issue with certain tests at + * present 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 + * + * comments on github for details + * This annotation is introduced as a temporary measure in order to decouple the functionality of + * {@link 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. + * + * @see ApiVersion + */ +@Deprecated +@Target({ METHOD }) +@Retention(RUNTIME) +@Qualifier +public @interface ApiVersionOverride { + + /** + * Value to override the default {@link ApiVersion}. + * + */ + String value(); + +} diff --git a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/features/AWSSubnetApi.java b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/features/AWSSubnetApi.java index b0f245acb2..f11699bd79 100644 --- a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/features/AWSSubnetApi.java +++ b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/features/AWSSubnetApi.java @@ -36,6 +36,7 @@ import org.jclouds.ec2.xml.DescribeSubnetsResponseHandler; import org.jclouds.ec2.xml.SubnetHandler; import org.jclouds.javax.annotation.Nullable; import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull; +import org.jclouds.rest.annotations.ApiVersionOverride; import org.jclouds.rest.annotations.BinderParam; import org.jclouds.rest.annotations.EndpointParam; import org.jclouds.rest.annotations.Fallback; @@ -141,7 +142,7 @@ public interface AWSSubnetApi extends SubnetApi { * @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 */ - @SinceApiVersion("2014-06-15") + @ApiVersionOverride("2014-06-15") @Named("ModifySubnetAttribute") @POST @Path("/")