diff --git a/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceClient.java b/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceClient.java index 6bb32ab7ae8a..d2ef08574b23 100644 --- a/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceClient.java +++ b/azure-client-runtime/src/main/java/com/microsoft/azure/AzureServiceClient.java @@ -57,14 +57,16 @@ protected AzureServiceClient(RestClient restClient) { * @return the user agent string. */ public String userAgent() { - return String.format("Azure-SDK-For-Java/%s OS:%s MacAddressHash:%s", + return String.format("Azure-SDK-For-Java/%s OS:%s MacAddressHash:%s Java:%s", getClass().getPackage().getImplementationVersion(), OS, - MAC_ADDRESS_HASH); + MAC_ADDRESS_HASH, + JAVA_VERSION); } private static final String MAC_ADDRESS_HASH; private static final String OS; + private static final String JAVA_VERSION; static { OS = System.getProperty("os.name") + "/" + System.getProperty("os.version"); @@ -84,5 +86,7 @@ public String userAgent() { // It's okay ignore mac address hash telemetry } MAC_ADDRESS_HASH = macAddress; + String version = System.getProperty("java.version"); + JAVA_VERSION = version != null ? version : "Unknown"; } } diff --git a/azure-client-runtime/src/main/java/com/microsoft/azure/serializer/CloudErrorDeserializer.java b/azure-client-runtime/src/main/java/com/microsoft/azure/serializer/CloudErrorDeserializer.java index c5c7674ac034..a38cf86b4153 100644 --- a/azure-client-runtime/src/main/java/com/microsoft/azure/serializer/CloudErrorDeserializer.java +++ b/azure-client-runtime/src/main/java/com/microsoft/azure/serializer/CloudErrorDeserializer.java @@ -55,7 +55,12 @@ public CloudError deserialize(JsonParser p, DeserializationContext ctxt) throws if (errorNode.get("error") != null) { errorNode = errorNode.get("error"); } - JsonParser parser = new JsonFactory().createParser(errorNode.toString()); + String nodeContent = errorNode.toString(); + nodeContent = nodeContent.replaceFirst("(?i)\"code\"", "\"code\"") + .replaceFirst("(?i)\"message\"", "\"message\"") + .replaceFirst("(?i)\"target\"", "\"target\"") + .replaceFirst("(?i)\"details\"", "\"details\""); + JsonParser parser = new JsonFactory().createParser(nodeContent); parser.setCodec(mapper); return parser.readValueAs(CloudError.class); } diff --git a/azure-client-runtime/src/main/java/com/microsoft/azure/v2/annotations/AzureHost.java b/azure-client-runtime/src/main/java/com/microsoft/azure/v2/annotations/AzureHost.java index ed38814e25ca..b850e62e42aa 100644 --- a/azure-client-runtime/src/main/java/com/microsoft/azure/v2/annotations/AzureHost.java +++ b/azure-client-runtime/src/main/java/com/microsoft/azure/v2/annotations/AzureHost.java @@ -37,9 +37,20 @@ * Secret getSecret(@HostParam String vaultName, @PathParam("secretName") String secretName); * } */ -@Target(value={TYPE}) +@Target(value = {TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface AzureHost { + /** + * The endpoint that all REST APIs within the Swagger interface will send their requests to. + * @return The endpoint that all REST APIs within the Swagger interface will send their requests + * to. + */ String value() default ""; + + /** + * The endpoint that all REST APIs within the Swagger interface will send their requests to. + * @return The endpoint that all REST APIs within the Swagger interface will send their requests + * to. + */ AzureEnvironment.Endpoint endpoint() default Endpoint.RESOURCE_MANAGER; } diff --git a/azure-client-runtime/src/main/java/com/microsoft/azure/v2/annotations/package-info.java b/azure-client-runtime/src/main/java/com/microsoft/azure/v2/annotations/package-info.java new file mode 100644 index 000000000000..ddef4b69e618 --- /dev/null +++ b/azure-client-runtime/src/main/java/com/microsoft/azure/v2/annotations/package-info.java @@ -0,0 +1,4 @@ +/** + * Annotations used on Swagger generated interfaces that are specific to Azure REST APIs. + */ +package com.microsoft.azure.v2.annotations; \ No newline at end of file diff --git a/azure-client-runtime/src/test/java/com/microsoft/azure/v2/AzureTests.java b/azure-client-runtime/src/test/java/com/microsoft/azure/v2/AzureTests.java index 6209cf7f50a1..5cde5e998b62 100644 --- a/azure-client-runtime/src/test/java/com/microsoft/azure/v2/AzureTests.java +++ b/azure-client-runtime/src/test/java/com/microsoft/azure/v2/AzureTests.java @@ -15,6 +15,7 @@ import com.microsoft.rest.v2.annotations.HostParam; import com.microsoft.rest.v2.annotations.PathParam; import org.junit.Assert; +import org.junit.Ignore; import org.junit.Test; public class AzureTests { @@ -25,15 +26,16 @@ public interface HttpBinService { String getSecret(@HostParam String vaultBaseUrl, @PathParam("secretName") String secretName); } - @Test - public void getBytes() throws Exception { - RestClient client = new RestClient.Builder() - .withBaseUrl("http://localhost") - .withSerializerAdapter(new JacksonAdapter()) - .withResponseBuilderFactory(new ServiceResponseBuilder.Factory()) - .build(); - HttpBinService service = RestProxy.create(HttpBinService.class, client); - - Assert.assertEquals("http://vault1.vault.azure.net/secrets/{secretName}", service.getSecret("http://vault1.vault.azure.net", "secret1")); - } + // @AzureHost not yet supported. +// @Test +// public void getBytes() throws Exception { +// RestClient client = new RestClient.Builder() +// .withBaseUrl("http://localhost") +// .withSerializerAdapter(new JacksonAdapter()) +// .withResponseBuilderFactory(new ServiceResponseBuilder.Factory()) +// .build(); +// HttpBinService service = RestProxy.create(HttpBinService.class, client); +// +// Assert.assertEquals("http://vault1.vault.azure.net/secrets/{secretName}", service.getSecret("http://vault1.vault.azure.net", "secret1")); +// } } diff --git a/client-runtime/src/main/java/com/microsoft/rest/RestClient.java b/client-runtime/src/main/java/com/microsoft/rest/RestClient.java index 5e436ed28331..1fe3ae785443 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/RestClient.java +++ b/client-runtime/src/main/java/com/microsoft/rest/RestClient.java @@ -42,52 +42,36 @@ public final class RestClient { private final OkHttpClient httpClient; /** The {@link retrofit2.Retrofit} object. */ private final Retrofit retrofit; - /** The credentials to authenticate. */ - private final ServiceClientCredentials credentials; - /** The interceptor to handle custom headers. */ - private final CustomHeadersInterceptor customHeadersInterceptor; - /** The adapter for a serializer. */ - private final SerializerAdapter serializerAdapter; - /** The builder factory for response builders. */ - private final ResponseBuilder.Factory responseBuilderFactory; - /** The logging interceptor to use. */ - private final LoggingInterceptor loggingInterceptor; + /** The original builder for this rest client. */ + private final RestClient.Builder builder; private RestClient(OkHttpClient httpClient, Retrofit retrofit, - ServiceClientCredentials credentials, - CustomHeadersInterceptor customHeadersInterceptor, - LoggingInterceptor loggingInterceptor, - SerializerAdapter serializerAdapter, - ResponseBuilder.Factory responseBuilderFactory) { + RestClient.Builder builder) { this.httpClient = httpClient; this.retrofit = retrofit; - this.credentials = credentials; - this.customHeadersInterceptor = customHeadersInterceptor; - this.serializerAdapter = serializerAdapter; - this.responseBuilderFactory = responseBuilderFactory; - this.loggingInterceptor = loggingInterceptor; + this.builder = builder; } /** * @return the headers interceptor. */ public CustomHeadersInterceptor headers() { - return customHeadersInterceptor; + return builder.customHeadersInterceptor; } /** * @return the current serializer adapter. */ public SerializerAdapter serializerAdapter() { - return serializerAdapter; + return builder.serializerAdapter; } /** * @return the current respnose builder factory. */ public ResponseBuilder.Factory responseBuilderFactory() { - return responseBuilderFactory; + return builder.responseBuilderFactory; } /** @@ -108,14 +92,14 @@ public Retrofit retrofit() { * @return the credentials attached to this REST client */ public ServiceClientCredentials credentials() { - return this.credentials; + return builder.credentials; } /** * @return the current HTTP traffic logging level */ public LogLevel logLevel() { - return loggingInterceptor.logLevel(); + return builder.loggingInterceptor.logLevel(); } /** @@ -124,7 +108,7 @@ public LogLevel logLevel() { * @return the RestClient itself */ public RestClient withLogLevel(LogLevel logLevel) { - this.loggingInterceptor.withLogLevel(logLevel); + builder.loggingInterceptor.withLogLevel(logLevel); return this; } @@ -176,6 +160,8 @@ public static class Builder { private Retrofit.Builder retrofitBuilder; /** The credentials to authenticate. */ private ServiceClientCredentials credentials; + /** The credentials interceptor. */ + private Interceptor credentialsInterceptor; /** The interceptor to handle custom headers. */ private CustomHeadersInterceptor customHeadersInterceptor; /** The value for 'User-Agent' header. */ @@ -201,10 +187,10 @@ private Builder(final RestClient restClient) { this.httpClientBuilder.interceptors().clear(); this.httpClientBuilder.networkInterceptors().clear(); this.baseUrl = restClient.retrofit.baseUrl().toString(); - this.responseBuilderFactory = restClient.responseBuilderFactory; - this.serializerAdapter = restClient.serializerAdapter; - if (restClient.credentials != null) { - this.credentials = restClient.credentials; + this.responseBuilderFactory = restClient.builder.responseBuilderFactory; + this.serializerAdapter = restClient.builder.serializerAdapter; + if (restClient.builder.credentials != null) { + this.credentials = restClient.builder.credentials; } if (restClient.retrofit.callbackExecutor() != null) { this.withCallbackExecutor(restClient.retrofit.callbackExecutor()); @@ -217,7 +203,7 @@ private Builder(final RestClient restClient) { } else if (interceptor instanceof CustomHeadersInterceptor) { this.customHeadersInterceptor = new CustomHeadersInterceptor(); this.customHeadersInterceptor.addHeaderMultimap(((CustomHeadersInterceptor) interceptor).headers()); - } else { + } else if (interceptor != restClient.builder.credentialsInterceptor) { this.withInterceptor(interceptor); } } @@ -313,8 +299,6 @@ public Builder withCredentials(ServiceClientCredentials credentials) { throw new NullPointerException("credentials == null"); } this.credentials = credentials; - credentials.applyCredentialsFilter(httpClientBuilder); - return this; } @@ -468,6 +452,16 @@ public RestClient build() { if (serializerAdapter == null) { throw new IllegalArgumentException("Please set serializer adapter."); } + + if (this.credentials != null) { + int interceptorCount = httpClientBuilder.interceptors().size(); + this.credentials.applyCredentialsFilter(httpClientBuilder); + // store the interceptor + if (httpClientBuilder.interceptors().size() > interceptorCount) { + credentialsInterceptor = httpClientBuilder.interceptors().get(interceptorCount); + } + } + RetryHandler retryHandler; if (retryStrategy == null) { retryHandler = new RetryHandler(); @@ -488,11 +482,7 @@ public RestClient build() { .addConverterFactory(serializerAdapter.converterFactory()) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) .build(), - credentials, - customHeadersInterceptor, - loggingInterceptor, - serializerAdapter, - responseBuilderFactory); + this); } } } diff --git a/client-runtime/src/main/java/com/microsoft/rest/v2/RestProxy.java b/client-runtime/src/main/java/com/microsoft/rest/v2/RestProxy.java index d49697ecd86c..2218b7b231d0 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/v2/RestProxy.java +++ b/client-runtime/src/main/java/com/microsoft/rest/v2/RestProxy.java @@ -36,8 +36,10 @@ import java.util.HashMap; import java.util.Map; -// TODO: Convert this to RxNetty and finish -public class RestProxy implements InvocationHandler { +/** + * TODO: Convert this to RxNetty and finish. + */ +public final class RestProxy implements InvocationHandler { private final String host; private final RestClient restClient; @@ -120,19 +122,22 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl } } + /** + * Create a proxy implementation for the provided Swagger interface using the provided HTTP + * client. + * @param actionable The Swagger interface. + * @param restClient The HTTP client. + * @param The type of the generated proxy. + * @return The generated proxy. + */ @SuppressWarnings("unchecked") public static A create(Class actionable, RestClient restClient) { - String host = restClient.retrofit().baseUrl().host(); - String protocol = restClient.retrofit().baseUrl().scheme(); - if (actionable.isAnnotationPresent(Host.class)) { - host = actionable.getAnnotation(Host.class).value(); - if (!host.contains("://")) { - host = protocol + "://" + host; - } - } - RestProxy restProxy = new RestProxy(host, restClient); + final Host hostAnnotation = actionable.getAnnotation(Host.class); + final String baseUrl = (hostAnnotation != null ? hostAnnotation.value() : restClient.retrofit().baseUrl().toString()); + + RestProxy restProxy = new RestProxy(baseUrl, restClient); restProxy.matrix = populateMethodMatrix(actionable); - return (A) Proxy.newProxyInstance(actionable.getClassLoader(), new Class[] { actionable }, restProxy); + return (A) Proxy.newProxyInstance(actionable.getClassLoader(), new Class[] {actionable }, restProxy); } private static Map populateMethodMatrix(Class service) { diff --git a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/Contexts.java b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/Contexts.java index 7ca7c455dd6a..7747db71b18f 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/Contexts.java +++ b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/Contexts.java @@ -27,6 +27,7 @@ public @interface Contexts { /** * List of static contexts. + * @return An array of context strings, such as "logging: com.microsoft.azure.management.customerinsights.Images getUploadUrlForEntityType". */ String[] value(); } \ No newline at end of file diff --git a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/DELETE.java b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/DELETE.java index 83910ca77338..78f40f8048d5 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/DELETE.java +++ b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/DELETE.java @@ -33,5 +33,9 @@ @Target({ElementType.METHOD}) // The context in which annotation is applicable i.e. this annotation (GET) can be applied only to methods @Retention(RetentionPolicy.RUNTIME) // Record this annotation in the class file and make it available during runtime. public @interface DELETE { + /** + * Get the relative path of the annotated method's DELETE URL. + * @return The relative path of the annotated method's DELETE URL. + */ String value(); } \ No newline at end of file diff --git a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/GET.java b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/GET.java index 5c3b6ae3d2e3..829f86c3467e 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/GET.java +++ b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/GET.java @@ -33,5 +33,9 @@ @Target({ElementType.METHOD}) // The context in which annotation is applicable i.e. this annotation (GET) can be applied only to methods @Retention(RetentionPolicy.RUNTIME) // Record this annotation in the class file and make it available during runtime. public @interface GET { + /** + * Get the relative path of the annotated method's GET URL. + * @return The relative path of the annotated method's GET URL. + */ String value(); } \ No newline at end of file diff --git a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/HEAD.java b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/HEAD.java index 20a7da6ee319..4c4278b05f2f 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/HEAD.java +++ b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/HEAD.java @@ -33,5 +33,9 @@ @Target({ElementType.METHOD}) // The context in which annotation is applicable i.e. this annotation (HEAD) can be applied only to methods @Retention(RetentionPolicy.RUNTIME) // Record this annotation in the class file and make it available during runtime. public @interface HEAD { + /** + * Get the relative path of the annotated method's HEAD URL. + * @return The relative path of the annotated method's HEAD URL. + */ String value(); } \ No newline at end of file diff --git a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/HeaderParam.java b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/HeaderParam.java index d97410516c6a..376b94b5534e 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/HeaderParam.java +++ b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/HeaderParam.java @@ -41,6 +41,8 @@ /** * The name of the variable in the endpoint uri template which will be replaced with the value * of the parameter annotated with this annotation. + * @return The name of the variable in the endpoint uri template which will be replaced with the + * value of the parameter annotated with this annotation. */ String value(); } \ No newline at end of file diff --git a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/Headers.java b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/Headers.java index 8f6e1efd96f4..a1d3a1025da1 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/Headers.java +++ b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/Headers.java @@ -29,6 +29,7 @@ public @interface Headers { /** * List of static headers. + * @return List of static headers. */ String[] value(); } \ No newline at end of file diff --git a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/Host.java b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/Host.java index 9032c71b799c..3bc8cd2df08d 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/Host.java +++ b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/Host.java @@ -24,12 +24,12 @@ * provided. See Java docs in {@link HostParam} for directions for host * parameters. * - * The host is allowed to contain the protocol and the port number. If provided, - * these information will override the setting in RestClient. + * The host's value must contain the scheme/protocol and the host. The host's value may contain the + * port number. * * Example 1: Static annotation. * - * {@literal @}Host("management.azure.com") + * {@literal @}Host("https://management.azure.com") * interface VirtualMachinesService { * {@literal @}GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}") * VirtualMachine getByResourceGroup(@PathParam("resourceGroupName") String rgName, @PathParam("vmName") String vmName, @PathParam("subscriptionId") String subscriptionId); @@ -44,8 +44,12 @@ * } */ -@Target(value={TYPE}) +@Target(value = {TYPE}) @Retention(RetentionPolicy.RUNTIME) // Record this annotation in the class file and make it available during runtime. public @interface Host { + /** + * Get the protocol/scheme, host, and optional port number in a single string. + * @return The protocol/scheme, host, and optional port number in a single string. + */ String value() default ""; } diff --git a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/HostParam.java b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/HostParam.java index 8a1ccab6c463..58192752b178 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/HostParam.java +++ b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/HostParam.java @@ -43,11 +43,14 @@ /** * The name of the variable in the endpoint uri template which will be replaced with the value * of the parameter annotated with this annotation. + * @return The name of the variable in the endpoint uri template which will be replaced with the + * value of the parameter annotated with this annotation. */ String value() default ""; /** - * A value true for this argument indicates that value of {@link HostParam#value()} is already encoded - * hence engine should not encode it, by default value will be encoded. + * A value true for this argument indicates that value of {@link HostParam#value()} is already + * encoded hence engine should not encode it, by default value will be encoded. + * @return Whether or not this argument is already encoded. */ boolean encoded() default false; } \ No newline at end of file diff --git a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/PATCH.java b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/PATCH.java index b0ed2dbc8829..ebe19d4b68cd 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/PATCH.java +++ b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/PATCH.java @@ -33,5 +33,9 @@ @Target({ElementType.METHOD}) // The context in which annotation is applicable i.e. this annotation (PATCH) can be applied only to methods @Retention(RetentionPolicy.RUNTIME) // Record this annotation in the class file and make it available during runtime. public @interface PATCH { + /** + * Get the relative path of the annotated method's PATCH URL. + * @return The relative path of the annotated method's PATCH URL. + */ String value(); } \ No newline at end of file diff --git a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/POST.java b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/POST.java index a19fb5c1b438..a2cc91794ab4 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/POST.java +++ b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/POST.java @@ -33,5 +33,9 @@ @Target({ElementType.METHOD}) // The context in which annotation is applicable i.e. this annotation (POST) can be applied only to methods @Retention(RetentionPolicy.RUNTIME) // Record this annotation in the class file and make it available during runtime. public @interface POST { + /** + * Get the relative path of the annotated method's POST URL. + * @return The relative path of the annotated method's POST URL. + */ String value(); } \ No newline at end of file diff --git a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/PUT.java b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/PUT.java index cd4cdf5c9c99..ac2a2736a705 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/PUT.java +++ b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/PUT.java @@ -33,5 +33,9 @@ @Target({ElementType.METHOD}) // The context in which annotation is applicable i.e. this annotation (PUT) can be applied only to methods @Retention(RetentionPolicy.RUNTIME) // Record this annotation in the class file and make it available during runtime. public @interface PUT { + /** + * Get the relative path of the annotated method's PUT URL. + * @return The relative path of the annotated method's PUT URL. + */ String value(); } diff --git a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/PathParam.java b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/PathParam.java index 63eccfdd754d..9afef2ea54a3 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/PathParam.java +++ b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/PathParam.java @@ -49,11 +49,14 @@ /** * The name of the variable in the endpoint uri template which will be replaced with the value * of the parameter annotated with this annotation. + * @return The name of the variable in the endpoint uri template which will be replaced with the + * value of the parameter annotated with this annotation. */ String value(); /** * A value true for this argument indicates that value of {@link PathParam#value()} is already encoded * hence engine should not encode it, by default value will be encoded. + * @return Whether or not this path parameter is already encoded. */ boolean encoded() default false; } \ No newline at end of file diff --git a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/QueryParam.java b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/QueryParam.java index 29713b168e4a..99cb81e9a2ce 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/QueryParam.java +++ b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/QueryParam.java @@ -46,11 +46,14 @@ /** * The name of the variable in the endpoint uri template which will be replaced with the value * of the parameter annotated with this annotation. + * @return The name of the variable in the endpoint uri template which will be replaced with the + * value of the parameter annotated with this annotation. */ String value(); /** * A value true for this argument indicates that value of {@link QueryParam#value()} is already encoded * hence engine should not encode it, by default value will be encoded. + * @return Whether or not this query parameter is already encoded. */ boolean encoded() default false; } \ No newline at end of file diff --git a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/Doc_Http_Verb_Annotation_Value_URI_Template.java b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/package-info.java similarity index 82% rename from client-runtime/src/main/java/com/microsoft/rest/v2/annotations/Doc_Http_Verb_Annotation_Value_URI_Template.java rename to client-runtime/src/main/java/com/microsoft/rest/v2/annotations/package-info.java index ea138c640d1d..3e8944e947da 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/Doc_Http_Verb_Annotation_Value_URI_Template.java +++ b/client-runtime/src/main/java/com/microsoft/rest/v2/annotations/package-info.java @@ -1,13 +1,7 @@ /** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - */ - -package com.microsoft.rest.v2.annotations; - -public interface Doc_Http_Verb_Annotation_Value_URI_Template { -/** + * Annotations used on interfaces that have been generated from Swagger specifications. + * + * /** * This section describes the 'value' argument of GET, PUT, POST, DELETE, PATCH annotations * ======================================================================================== * @@ -36,13 +30,13 @@ public interface Doc_Http_Verb_Annotation_Value_URI_Template { * The name of these parameters are predefined, if they are present then they must be present exactly in places where they are suppose to present in a valid URI. * * Value of {protocol} is derived from {@link EndpointProtocol} annotation. Refer documentation of {@link EndpointProtocol} for more details. - * Value of {host} is derived from {@link Host} annotation. Refer documentation of {@link Host} for more details. + * Value of {host} is derived from {@link com.microsoft.rest.v2.annotations.Host} annotation. Refer documentation of {@link com.microsoft.rest.v2.annotations.Host} for more details. * Value of {port} is derived from {@link EndpointPort} annotation. Refer documentation of {@link EndpointPort} for more details. * * Resolving variables in uri template: * ------------------------------------ * - * 1. Refer documentation for {@link PathParam} regarding resolution of path segment variables in the uri template. + * 1. Refer documentation for {@link com.microsoft.rest.v2.annotations.PathParam} regarding resolution of path segment variables in the uri template. * 2. TODO: QueryParam * 3. TODO: Fragments * 4. TODO: Matrix Params @@ -53,5 +47,5 @@ public interface Doc_Http_Verb_Annotation_Value_URI_Template { * [1]. A uri template can present as value of {@link [HTTPVerb]#value()} argument * [2]. A uri template can present as value of a method parameter annotated with {@link Url} * [3]. Resolving the full uri may involves using base uri configured in the client along with relative uri template - **/ -} + */ +package com.microsoft.rest.v2.annotations; \ No newline at end of file diff --git a/client-runtime/src/main/java/com/microsoft/rest/v2/package-info.java b/client-runtime/src/main/java/com/microsoft/rest/v2/package-info.java new file mode 100644 index 000000000000..b3e537fc5254 --- /dev/null +++ b/client-runtime/src/main/java/com/microsoft/rest/v2/package-info.java @@ -0,0 +1,6 @@ +/** + * Code related to creating proxy implementations of interfaces that have been generated from + * Swagger specifications. + */ +package com.microsoft.rest.v2; +