Skip to content
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

[AutoPR resources/resource-manager] Fix Swagger Linting Error for Microsoft.Features #2377

Merged
merged 2 commits into from
Sep 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/

package com.microsoft.azure.management.features.v2015_12_01;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
* The object that represents the operation.
*/
public class OperationDisplay {
/**
* Service provider: Microsoft.Features.
*/
@JsonProperty(value = "provider")
private String provider;

/**
* Resource on which the operation is performed: Profile, endpoint, etc.
*/
@JsonProperty(value = "resource")
private String resource;

/**
* Operation type: Read, write, delete, etc.
*/
@JsonProperty(value = "operation")
private String operation;

/**
* Get service provider: Microsoft.Features.
*
* @return the provider value
*/
public String provider() {
return this.provider;
}

/**
* Set service provider: Microsoft.Features.
*
* @param provider the provider value to set
* @return the OperationDisplay object itself.
*/
public OperationDisplay withProvider(String provider) {
this.provider = provider;
return this;
}

/**
* Get resource on which the operation is performed: Profile, endpoint, etc.
*
* @return the resource value
*/
public String resource() {
return this.resource;
}

/**
* Set resource on which the operation is performed: Profile, endpoint, etc.
*
* @param resource the resource value to set
* @return the OperationDisplay object itself.
*/
public OperationDisplay withResource(String resource) {
this.resource = resource;
return this;
}

/**
* Get operation type: Read, write, delete, etc.
*
* @return the operation value
*/
public String operation() {
return this.operation;
}

/**
* Set operation type: Read, write, delete, etc.
*
* @param operation the operation value to set
* @return the OperationDisplay object itself.
*/
public OperationDisplay withOperation(String operation) {
this.operation = operation;
return this;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,36 @@

package com.microsoft.azure.management.features.v2015_12_01.implementation;

import com.google.common.reflect.TypeToken;
import com.microsoft.azure.AzureClient;
import com.microsoft.azure.AzureServiceClient;
import com.microsoft.azure.AzureServiceFuture;
import com.microsoft.azure.CloudException;
import com.microsoft.azure.ListOperationCallback;
import com.microsoft.azure.Page;
import com.microsoft.azure.PagedList;
import com.microsoft.rest.credentials.ServiceClientCredentials;
import com.microsoft.rest.RestClient;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponse;
import java.io.IOException;
import java.util.List;
import okhttp3.ResponseBody;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.Query;
import retrofit2.http.Url;
import retrofit2.Response;
import rx.functions.Func1;
import rx.Observable;

/**
* Initializes a new instance of the FeatureClientImpl class.
*/
public class FeatureClientImpl extends AzureServiceClient {
/** The Retrofit service to perform REST calls. */
private FeatureClientService service;
/** the {@link AzureClient} used for long running operations. */
private AzureClient azureClient;

Expand Down Expand Up @@ -182,6 +203,7 @@ protected void initialize() {
this.generateClientRequestId = true;
this.features = new FeaturesInner(restClient().retrofit(), this);
this.azureClient = new AzureClient(this);
initializeService();
}

/**
Expand All @@ -193,4 +215,239 @@ protected void initialize() {
public String userAgent() {
return String.format("%s (%s, %s)", super.userAgent(), "FeatureClient", "2015-12-01");
}

private void initializeService() {
service = restClient().retrofit().create(FeatureClientService.class);
}

/**
* The interface defining all the services for FeatureClient to be
* used by Retrofit to perform actually REST calls.
*/
interface FeatureClientService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.features.v2015_12_01.FeatureClient listOperations" })
@GET("providers/Microsoft.Features/operations")
Observable<Response<ResponseBody>> listOperations(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.features.v2015_12_01.FeatureClient listOperationsNext" })
@GET
Observable<Response<ResponseBody>> listOperationsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);

}

/**
* Lists all of the available Microsoft.Features REST API operations.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList&lt;OperationInner&gt; object if successful.
*/
public PagedList<OperationInner> listOperations() {
ServiceResponse<Page<OperationInner>> response = listOperationsSinglePageAsync().toBlocking().single();
return new PagedList<OperationInner>(response.body()) {
@Override
public Page<OperationInner> nextPage(String nextPageLink) {
return listOperationsNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}

/**
* Lists all of the available Microsoft.Features REST API operations.
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<List<OperationInner>> listOperationsAsync(final ListOperationCallback<OperationInner> serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listOperationsSinglePageAsync(),
new Func1<String, Observable<ServiceResponse<Page<OperationInner>>>>() {
@Override
public Observable<ServiceResponse<Page<OperationInner>>> call(String nextPageLink) {
return listOperationsNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}

/**
* Lists all of the available Microsoft.Features REST API operations.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;OperationInner&gt; object
*/
public Observable<Page<OperationInner>> listOperationsAsync() {
return listOperationsWithServiceResponseAsync()
.map(new Func1<ServiceResponse<Page<OperationInner>>, Page<OperationInner>>() {
@Override
public Page<OperationInner> call(ServiceResponse<Page<OperationInner>> response) {
return response.body();
}
});
}

/**
* Lists all of the available Microsoft.Features REST API operations.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;OperationInner&gt; object
*/
public Observable<ServiceResponse<Page<OperationInner>>> listOperationsWithServiceResponseAsync() {
return listOperationsSinglePageAsync()
.concatMap(new Func1<ServiceResponse<Page<OperationInner>>, Observable<ServiceResponse<Page<OperationInner>>>>() {
@Override
public Observable<ServiceResponse<Page<OperationInner>>> call(ServiceResponse<Page<OperationInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listOperationsNextWithServiceResponseAsync(nextPageLink));
}
});
}

/**
* Lists all of the available Microsoft.Features REST API operations.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList&lt;OperationInner&gt; object wrapped in {@link ServiceResponse} if successful.
*/
public Observable<ServiceResponse<Page<OperationInner>>> listOperationsSinglePageAsync() {
if (this.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
}
return service.listOperations(this.apiVersion(), this.acceptLanguage(), this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<OperationInner>>>>() {
@Override
public Observable<ServiceResponse<Page<OperationInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<OperationInner>> result = listOperationsDelegate(response);
return Observable.just(new ServiceResponse<Page<OperationInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}

private ServiceResponse<PageImpl<OperationInner>> listOperationsDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.restClient().responseBuilderFactory().<PageImpl<OperationInner>, CloudException>newInstance(this.serializerAdapter())
.register(200, new TypeToken<PageImpl<OperationInner>>() { }.getType())
.registerError(CloudException.class)
.build(response);
}

/**
* Lists all of the available Microsoft.Features REST API operations.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList&lt;OperationInner&gt; object if successful.
*/
public PagedList<OperationInner> listOperationsNext(final String nextPageLink) {
ServiceResponse<Page<OperationInner>> response = listOperationsNextSinglePageAsync(nextPageLink).toBlocking().single();
return new PagedList<OperationInner>(response.body()) {
@Override
public Page<OperationInner> nextPage(String nextPageLink) {
return listOperationsNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}

/**
* Lists all of the available Microsoft.Features REST API operations.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @param serviceFuture the ServiceFuture object tracking the Retrofit calls
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<List<OperationInner>> listOperationsNextAsync(final String nextPageLink, final ServiceFuture<List<OperationInner>> serviceFuture, final ListOperationCallback<OperationInner> serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listOperationsNextSinglePageAsync(nextPageLink),
new Func1<String, Observable<ServiceResponse<Page<OperationInner>>>>() {
@Override
public Observable<ServiceResponse<Page<OperationInner>>> call(String nextPageLink) {
return listOperationsNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}

/**
* Lists all of the available Microsoft.Features REST API operations.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;OperationInner&gt; object
*/
public Observable<Page<OperationInner>> listOperationsNextAsync(final String nextPageLink) {
return listOperationsNextWithServiceResponseAsync(nextPageLink)
.map(new Func1<ServiceResponse<Page<OperationInner>>, Page<OperationInner>>() {
@Override
public Page<OperationInner> call(ServiceResponse<Page<OperationInner>> response) {
return response.body();
}
});
}

/**
* Lists all of the available Microsoft.Features REST API operations.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList&lt;OperationInner&gt; object
*/
public Observable<ServiceResponse<Page<OperationInner>>> listOperationsNextWithServiceResponseAsync(final String nextPageLink) {
return listOperationsNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<OperationInner>>, Observable<ServiceResponse<Page<OperationInner>>>>() {
@Override
public Observable<ServiceResponse<Page<OperationInner>>> call(ServiceResponse<Page<OperationInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listOperationsNextWithServiceResponseAsync(nextPageLink));
}
});
}

/**
* Lists all of the available Microsoft.Features REST API operations.
*
ServiceResponse<PageImpl<OperationInner>> * @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList&lt;OperationInner&gt; object wrapped in {@link ServiceResponse} if successful.
*/
public Observable<ServiceResponse<Page<OperationInner>>> listOperationsNextSinglePageAsync(final String nextPageLink) {
if (nextPageLink == null) {
throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
}
String nextUrl = String.format("%s", nextPageLink);
return service.listOperationsNext(nextUrl, this.acceptLanguage(), this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<OperationInner>>>>() {
@Override
public Observable<ServiceResponse<Page<OperationInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<OperationInner>> result = listOperationsNextDelegate(response);
return Observable.just(new ServiceResponse<Page<OperationInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}

private ServiceResponse<PageImpl<OperationInner>> listOperationsNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.restClient().responseBuilderFactory().<PageImpl<OperationInner>, CloudException>newInstance(this.serializerAdapter())
.register(200, new TypeToken<PageImpl<OperationInner>>() { }.getType())
.registerError(CloudException.class)
.build(response);
}

}
Loading