Skip to content

Commit

Permalink
Merge pull request #1 from jianghaolu/bengmaster
Browse files Browse the repository at this point in the history
Support parameterized hosts in Java
  • Loading branch information
begoldsm committed Feb 17, 2016
2 parents e6cfa1e + 14ecdd3 commit 0d1e6ab
Show file tree
Hide file tree
Showing 77 changed files with 769 additions and 587 deletions.
1 change: 1 addition & 0 deletions AutoRest/Generators/Extensions/Extensions/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public static void ProcessParameterizedHost(ServiceClient serviceClient, Setting
{
parameter.ClientProperty = serviceClient.Properties.Single(p => p.SerializedName.Equals(parameter.SerializedName));
}
parameter.Extensions["hostParameter"] = true;

foreach (var method in serviceClient.Methods)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
package fixtures.azureparametergrouping;

import com.microsoft.azure.AzureClient;
import com.microsoft.rest.AutoRestBaseUrl;
import com.microsoft.rest.credentials.ServiceClientCredentials;
import com.microsoft.rest.serializer.JacksonMapperAdapter;
import java.util.List;
Expand All @@ -22,10 +23,11 @@
*/
public interface AutoRestParameterGroupingTestService {
/**
* Gets the URI used as the base for all cloud service requests.
* @return The BaseUri value.
* Gets the URL used as the base for all cloud service requests.
*
* @return the BaseUrl object.
*/
String getBaseUri();
AutoRestBaseUrl getBaseUrl();

/**
* Gets the list of interceptors the OkHttp client will execute.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.microsoft.azure.AzureClient;
import com.microsoft.azure.AzureServiceClient;
import com.microsoft.azure.CustomHeaderInterceptor;
import com.microsoft.rest.AutoRestBaseUrl;
import com.microsoft.rest.credentials.ServiceClientCredentials;
import java.util.UUID;
import okhttp3.OkHttpClient;
Expand All @@ -22,17 +23,18 @@
* Initializes a new instance of the AutoRestParameterGroupingTestService class.
*/
public final class AutoRestParameterGroupingTestServiceImpl extends AzureServiceClient implements AutoRestParameterGroupingTestService {
/** The URI used as the base for all cloud service requests. */
private final String baseUri;
/** The URL used as the base for all cloud service requests. */
private final AutoRestBaseUrl baseUrl;
/** the {@link AzureClient} used for long running operations. */
private AzureClient azureClient;

/**
* Gets the URI used as the base for all cloud service requests.
* @return The BaseUri value.
* Gets the URL used as the base for all cloud service requests.
*
* @return The BaseUrl value.
*/
public String getBaseUri() {
return this.baseUri;
public AutoRestBaseUrl getBaseUrl() {
return this.baseUrl;
}

/**
Expand Down Expand Up @@ -136,10 +138,10 @@ public AutoRestParameterGroupingTestServiceImpl() {
/**
* Initializes an instance of AutoRestParameterGroupingTestService client.
*
* @param baseUri the base URI of the host
* @param baseUrl the base URL of the host
*/
public AutoRestParameterGroupingTestServiceImpl(String baseUri) {
this(baseUri, null);
public AutoRestParameterGroupingTestServiceImpl(String baseUrl) {
this(baseUrl, null);
}

/**
Expand All @@ -154,27 +156,27 @@ public AutoRestParameterGroupingTestServiceImpl(ServiceClientCredentials credent
/**
* Initializes an instance of AutoRestParameterGroupingTestService client.
*
* @param baseUri the base URI of the host
* @param baseUrl the base URL of the host
* @param credentials the management credentials for Azure
*/
public AutoRestParameterGroupingTestServiceImpl(String baseUri, ServiceClientCredentials credentials) {
public AutoRestParameterGroupingTestServiceImpl(String baseUrl, ServiceClientCredentials credentials) {
super();
this.baseUri = baseUri;
this.baseUrl = new AutoRestBaseUrl(baseUrl);
this.credentials = credentials;
initialize();
}

/**
* Initializes an instance of AutoRestParameterGroupingTestService client.
*
* @param baseUri the base URI of the host
* @param baseUrl the base URL of the host
* @param credentials the management credentials for Azure
* @param clientBuilder the builder for building up an {@link OkHttpClient}
* @param retrofitBuilder the builder for building up a {@link Retrofit}
*/
public AutoRestParameterGroupingTestServiceImpl(String baseUri, ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) {
public AutoRestParameterGroupingTestServiceImpl(String baseUrl, ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) {
super(clientBuilder, retrofitBuilder);
this.baseUri = baseUri;
this.baseUrl = new AutoRestBaseUrl(baseUrl);
this.credentials = credentials;
initialize();
}
Expand All @@ -191,6 +193,6 @@ protected void initialize() {
super.initialize();
this.azureClient = new AzureClient(clientBuilder, retrofitBuilder);
this.azureClient.setCredentials(this.credentials);
this.retrofitBuilder.baseUrl(baseUri);
this.retrofitBuilder.baseUrl(baseUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
package fixtures.azurereport;

import com.microsoft.azure.AzureClient;
import com.microsoft.rest.AutoRestBaseUrl;
import com.microsoft.rest.credentials.ServiceClientCredentials;
import com.microsoft.rest.serializer.JacksonMapperAdapter;
import com.microsoft.rest.ServiceCallback;
Expand All @@ -32,10 +33,11 @@
*/
public interface AutoRestReportServiceForAzure {
/**
* Gets the URI used as the base for all cloud service requests.
* @return The BaseUri value.
* Gets the URL used as the base for all cloud service requests.
*
* @return the BaseUrl object.
*/
String getBaseUri();
AutoRestBaseUrl getBaseUrl();

/**
* Gets the list of interceptors the OkHttp client will execute.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.microsoft.azure.AzureServiceClient;
import com.microsoft.azure.AzureServiceResponseBuilder;
import com.microsoft.azure.CustomHeaderInterceptor;
import com.microsoft.rest.AutoRestBaseUrl;
import com.microsoft.rest.credentials.ServiceClientCredentials;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceResponse;
Expand All @@ -36,17 +37,18 @@
public final class AutoRestReportServiceForAzureImpl extends AzureServiceClient implements AutoRestReportServiceForAzure {
/** The Retrofit service to perform REST calls. */
private AutoRestReportServiceForAzureService service;
/** The URI used as the base for all cloud service requests. */
private final String baseUri;
/** The URL used as the base for all cloud service requests. */
private final AutoRestBaseUrl baseUrl;
/** the {@link AzureClient} used for long running operations. */
private AzureClient azureClient;

/**
* Gets the URI used as the base for all cloud service requests.
* @return The BaseUri value.
* Gets the URL used as the base for all cloud service requests.
*
* @return The BaseUrl value.
*/
public String getBaseUri() {
return this.baseUri;
public AutoRestBaseUrl getBaseUrl() {
return this.baseUrl;
}

/**
Expand Down Expand Up @@ -142,10 +144,10 @@ public AutoRestReportServiceForAzureImpl() {
/**
* Initializes an instance of AutoRestReportServiceForAzure client.
*
* @param baseUri the base URI of the host
* @param baseUrl the base URL of the host
*/
public AutoRestReportServiceForAzureImpl(String baseUri) {
this(baseUri, null);
public AutoRestReportServiceForAzureImpl(String baseUrl) {
this(baseUrl, null);
}

/**
Expand All @@ -160,27 +162,27 @@ public AutoRestReportServiceForAzureImpl(ServiceClientCredentials credentials) {
/**
* Initializes an instance of AutoRestReportServiceForAzure client.
*
* @param baseUri the base URI of the host
* @param baseUrl the base URL of the host
* @param credentials the management credentials for Azure
*/
public AutoRestReportServiceForAzureImpl(String baseUri, ServiceClientCredentials credentials) {
public AutoRestReportServiceForAzureImpl(String baseUrl, ServiceClientCredentials credentials) {
super();
this.baseUri = baseUri;
this.baseUrl = new AutoRestBaseUrl(baseUrl);
this.credentials = credentials;
initialize();
}

/**
* Initializes an instance of AutoRestReportServiceForAzure client.
*
* @param baseUri the base URI of the host
* @param baseUrl the base URL of the host
* @param credentials the management credentials for Azure
* @param clientBuilder the builder for building up an {@link OkHttpClient}
* @param retrofitBuilder the builder for building up a {@link Retrofit}
*/
public AutoRestReportServiceForAzureImpl(String baseUri, ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) {
public AutoRestReportServiceForAzureImpl(String baseUrl, ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) {
super(clientBuilder, retrofitBuilder);
this.baseUri = baseUri;
this.baseUrl = new AutoRestBaseUrl(baseUrl);
this.credentials = credentials;
initialize();
}
Expand All @@ -197,7 +199,7 @@ protected void initialize() {
super.initialize();
this.azureClient = new AzureClient(clientBuilder, retrofitBuilder);
this.azureClient.setCredentials(this.credentials);
this.retrofitBuilder.baseUrl(baseUri);
this.retrofitBuilder.baseUrl(baseUrl);
initializeService();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
package fixtures.azurespecials;

import com.microsoft.azure.AzureClient;
import com.microsoft.rest.AutoRestBaseUrl;
import com.microsoft.rest.credentials.ServiceClientCredentials;
import com.microsoft.rest.serializer.JacksonMapperAdapter;
import java.util.List;
Expand All @@ -22,10 +23,11 @@
*/
public interface AutoRestAzureSpecialParametersTestClient {
/**
* Gets the URI used as the base for all cloud service requests.
* @return The BaseUri value.
* Gets the URL used as the base for all cloud service requests.
*
* @return the BaseUrl object.
*/
String getBaseUri();
AutoRestBaseUrl getBaseUrl();

/**
* Gets the list of interceptors the OkHttp client will execute.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.microsoft.azure.AzureClient;
import com.microsoft.azure.AzureServiceClient;
import com.microsoft.azure.CustomHeaderInterceptor;
import com.microsoft.rest.AutoRestBaseUrl;
import com.microsoft.rest.credentials.ServiceClientCredentials;
import java.util.UUID;
import okhttp3.OkHttpClient;
Expand All @@ -22,17 +23,18 @@
* Initializes a new instance of the AutoRestAzureSpecialParametersTestClient class.
*/
public final class AutoRestAzureSpecialParametersTestClientImpl extends AzureServiceClient implements AutoRestAzureSpecialParametersTestClient {
/** The URI used as the base for all cloud service requests. */
private final String baseUri;
/** The URL used as the base for all cloud service requests. */
private final AutoRestBaseUrl baseUrl;
/** the {@link AzureClient} used for long running operations. */
private AzureClient azureClient;

/**
* Gets the URI used as the base for all cloud service requests.
* @return The BaseUri value.
* Gets the URL used as the base for all cloud service requests.
*
* @return The BaseUrl value.
*/
public String getBaseUri() {
return this.baseUri;
public AutoRestBaseUrl getBaseUrl() {
return this.baseUrl;
}

/**
Expand Down Expand Up @@ -225,10 +227,10 @@ public AutoRestAzureSpecialParametersTestClientImpl() {
/**
* Initializes an instance of AutoRestAzureSpecialParametersTestClient client.
*
* @param baseUri the base URI of the host
* @param baseUrl the base URL of the host
*/
public AutoRestAzureSpecialParametersTestClientImpl(String baseUri) {
this(baseUri, null);
public AutoRestAzureSpecialParametersTestClientImpl(String baseUrl) {
this(baseUrl, null);
}

/**
Expand All @@ -243,27 +245,27 @@ public AutoRestAzureSpecialParametersTestClientImpl(ServiceClientCredentials cre
/**
* Initializes an instance of AutoRestAzureSpecialParametersTestClient client.
*
* @param baseUri the base URI of the host
* @param baseUrl the base URL of the host
* @param credentials the management credentials for Azure
*/
public AutoRestAzureSpecialParametersTestClientImpl(String baseUri, ServiceClientCredentials credentials) {
public AutoRestAzureSpecialParametersTestClientImpl(String baseUrl, ServiceClientCredentials credentials) {
super();
this.baseUri = baseUri;
this.baseUrl = new AutoRestBaseUrl(baseUrl);
this.credentials = credentials;
initialize();
}

/**
* Initializes an instance of AutoRestAzureSpecialParametersTestClient client.
*
* @param baseUri the base URI of the host
* @param baseUrl the base URL of the host
* @param credentials the management credentials for Azure
* @param clientBuilder the builder for building up an {@link OkHttpClient}
* @param retrofitBuilder the builder for building up a {@link Retrofit}
*/
public AutoRestAzureSpecialParametersTestClientImpl(String baseUri, ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) {
public AutoRestAzureSpecialParametersTestClientImpl(String baseUrl, ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder retrofitBuilder) {
super(clientBuilder, retrofitBuilder);
this.baseUri = baseUri;
this.baseUrl = new AutoRestBaseUrl(baseUrl);
this.credentials = credentials;
initialize();
}
Expand All @@ -281,6 +283,6 @@ protected void initialize() {
super.initialize();
this.azureClient = new AzureClient(clientBuilder, retrofitBuilder);
this.azureClient.setCredentials(this.credentials);
this.retrofitBuilder.baseUrl(baseUri);
this.retrofitBuilder.baseUrl(baseUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
package fixtures.custombaseuri;

import com.microsoft.azure.AzureClient;
import com.microsoft.rest.AutoRestBaseUrl;
import com.microsoft.rest.credentials.ServiceClientCredentials;
import com.microsoft.rest.serializer.JacksonMapperAdapter;
import java.util.List;
Expand All @@ -22,10 +23,11 @@
*/
public interface AutoRestParameterizedHostTestClient {
/**
* Gets the URI used as the base for all cloud service requests.
* @return The BaseUri value.
* Gets the URL used as the base for all cloud service requests.
*
* @return the BaseUrl object.
*/
String getBaseUri();
AutoRestBaseUrl getBaseUrl();

/**
* Gets the list of interceptors the OkHttp client will execute.
Expand Down
Loading

0 comments on commit 0d1e6ab

Please sign in to comment.