com.microsoft.azure.management.network.implementation.VpnSiteLinksInner Maven / Gradle / Ivy
/**
* 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.network.implementation;
import retrofit2.Retrofit;
import com.google.common.reflect.TypeToken;
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.ServiceCallback;
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.Path;
import retrofit2.http.Query;
import retrofit2.http.Url;
import retrofit2.Response;
import rx.functions.Func1;
import rx.Observable;
/**
* An instance of this class provides access to all the operations defined
* in VpnSiteLinks.
*/
public class VpnSiteLinksInner {
/** The Retrofit service to perform REST calls. */
private VpnSiteLinksService service;
/** The service client containing this operation class. */
private NetworkManagementClientImpl client;
/**
* Initializes an instance of VpnSiteLinksInner.
*
* @param retrofit the Retrofit instance built from a Retrofit Builder.
* @param client the instance of the service client containing this operation class.
*/
public VpnSiteLinksInner(Retrofit retrofit, NetworkManagementClientImpl client) {
this.service = retrofit.create(VpnSiteLinksService.class);
this.client = client;
}
/**
* The interface defining all the services for VpnSiteLinks to be
* used by Retrofit to perform actually REST calls.
*/
interface VpnSiteLinksService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.network.VpnSiteLinks get" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}/vpnSiteLinks/{vpnSiteLinkName}")
Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("vpnSiteName") String vpnSiteName, @Path("vpnSiteLinkName") String vpnSiteLinkName, @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.network.VpnSiteLinks listByVpnSite" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}/vpnSiteLinks")
Observable> listByVpnSite(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("vpnSiteName") String vpnSiteName, @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.network.VpnSiteLinks listByVpnSiteNext" })
@GET
Observable> listByVpnSiteNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
}
/**
* Retrieves the details of a VPN site link.
*
* @param resourceGroupName The resource group name of the VpnSite.
* @param vpnSiteName The name of the VpnSite.
* @param vpnSiteLinkName The name of the VpnSiteLink being retrieved.
* @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 VpnSiteLinkInner object if successful.
*/
public VpnSiteLinkInner get(String resourceGroupName, String vpnSiteName, String vpnSiteLinkName) {
return getWithServiceResponseAsync(resourceGroupName, vpnSiteName, vpnSiteLinkName).toBlocking().single().body();
}
/**
* Retrieves the details of a VPN site link.
*
* @param resourceGroupName The resource group name of the VpnSite.
* @param vpnSiteName The name of the VpnSite.
* @param vpnSiteLinkName The name of the VpnSiteLink being retrieved.
* @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 getAsync(String resourceGroupName, String vpnSiteName, String vpnSiteLinkName, final ServiceCallback serviceCallback) {
return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, vpnSiteName, vpnSiteLinkName), serviceCallback);
}
/**
* Retrieves the details of a VPN site link.
*
* @param resourceGroupName The resource group name of the VpnSite.
* @param vpnSiteName The name of the VpnSite.
* @param vpnSiteLinkName The name of the VpnSiteLink being retrieved.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the VpnSiteLinkInner object
*/
public Observable getAsync(String resourceGroupName, String vpnSiteName, String vpnSiteLinkName) {
return getWithServiceResponseAsync(resourceGroupName, vpnSiteName, vpnSiteLinkName).map(new Func1, VpnSiteLinkInner>() {
@Override
public VpnSiteLinkInner call(ServiceResponse response) {
return response.body();
}
});
}
/**
* Retrieves the details of a VPN site link.
*
* @param resourceGroupName The resource group name of the VpnSite.
* @param vpnSiteName The name of the VpnSite.
* @param vpnSiteLinkName The name of the VpnSiteLink being retrieved.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the VpnSiteLinkInner object
*/
public Observable> getWithServiceResponseAsync(String resourceGroupName, String vpnSiteName, String vpnSiteLinkName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (vpnSiteName == null) {
throw new IllegalArgumentException("Parameter vpnSiteName is required and cannot be null.");
}
if (vpnSiteLinkName == null) {
throw new IllegalArgumentException("Parameter vpnSiteLinkName is required and cannot be null.");
}
final String apiVersion = "2019-11-01";
return service.get(this.client.subscriptionId(), resourceGroupName, vpnSiteName, vpnSiteLinkName, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponse clientResponse = getDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
.register(200, new TypeToken() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Lists all the vpnSiteLinks in a resource group for a vpn site.
*
* @param resourceGroupName The resource group name of the VpnSite.
* @param vpnSiteName The name of the VpnSite.
* @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<VpnSiteLinkInner> object if successful.
*/
public PagedList listByVpnSite(final String resourceGroupName, final String vpnSiteName) {
ServiceResponse> response = listByVpnSiteSinglePageAsync(resourceGroupName, vpnSiteName).toBlocking().single();
return new PagedList(response.body()) {
@Override
public Page nextPage(String nextPageLink) {
return listByVpnSiteNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}
/**
* Lists all the vpnSiteLinks in a resource group for a vpn site.
*
* @param resourceGroupName The resource group name of the VpnSite.
* @param vpnSiteName The name of the VpnSite.
* @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> listByVpnSiteAsync(final String resourceGroupName, final String vpnSiteName, final ListOperationCallback serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listByVpnSiteSinglePageAsync(resourceGroupName, vpnSiteName),
new Func1>>>() {
@Override
public Observable>> call(String nextPageLink) {
return listByVpnSiteNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}
/**
* Lists all the vpnSiteLinks in a resource group for a vpn site.
*
* @param resourceGroupName The resource group name of the VpnSite.
* @param vpnSiteName The name of the VpnSite.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<VpnSiteLinkInner> object
*/
public Observable> listByVpnSiteAsync(final String resourceGroupName, final String vpnSiteName) {
return listByVpnSiteWithServiceResponseAsync(resourceGroupName, vpnSiteName)
.map(new Func1>, Page>() {
@Override
public Page call(ServiceResponse> response) {
return response.body();
}
});
}
/**
* Lists all the vpnSiteLinks in a resource group for a vpn site.
*
* @param resourceGroupName The resource group name of the VpnSite.
* @param vpnSiteName The name of the VpnSite.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<VpnSiteLinkInner> object
*/
public Observable>> listByVpnSiteWithServiceResponseAsync(final String resourceGroupName, final String vpnSiteName) {
return listByVpnSiteSinglePageAsync(resourceGroupName, vpnSiteName)
.concatMap(new Func1>, Observable>>>() {
@Override
public Observable>> call(ServiceResponse> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByVpnSiteNextWithServiceResponseAsync(nextPageLink));
}
});
}
/**
* Lists all the vpnSiteLinks in a resource group for a vpn site.
*
ServiceResponse> * @param resourceGroupName The resource group name of the VpnSite.
ServiceResponse> * @param vpnSiteName The name of the VpnSite.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<VpnSiteLinkInner> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable>> listByVpnSiteSinglePageAsync(final String resourceGroupName, final String vpnSiteName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (vpnSiteName == null) {
throw new IllegalArgumentException("Parameter vpnSiteName is required and cannot be null.");
}
final String apiVersion = "2019-11-01";
return service.listByVpnSite(this.client.subscriptionId(), resourceGroupName, vpnSiteName, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1, Observable>>>() {
@Override
public Observable>> call(Response response) {
try {
ServiceResponse> result = listByVpnSiteDelegate(response);
return Observable.just(new ServiceResponse>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse> listByVpnSiteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Lists all the vpnSiteLinks in a resource group for a vpn site.
*
* @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<VpnSiteLinkInner> object if successful.
*/
public PagedList listByVpnSiteNext(final String nextPageLink) {
ServiceResponse> response = listByVpnSiteNextSinglePageAsync(nextPageLink).toBlocking().single();
return new PagedList(response.body()) {
@Override
public Page nextPage(String nextPageLink) {
return listByVpnSiteNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}
/**
* Lists all the vpnSiteLinks in a resource group for a vpn site.
*
* @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> listByVpnSiteNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listByVpnSiteNextSinglePageAsync(nextPageLink),
new Func1>>>() {
@Override
public Observable>> call(String nextPageLink) {
return listByVpnSiteNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}
/**
* Lists all the vpnSiteLinks in a resource group for a vpn site.
*
* @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<VpnSiteLinkInner> object
*/
public Observable> listByVpnSiteNextAsync(final String nextPageLink) {
return listByVpnSiteNextWithServiceResponseAsync(nextPageLink)
.map(new Func1>, Page>() {
@Override
public Page call(ServiceResponse> response) {
return response.body();
}
});
}
/**
* Lists all the vpnSiteLinks in a resource group for a vpn site.
*
* @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<VpnSiteLinkInner> object
*/
public Observable>> listByVpnSiteNextWithServiceResponseAsync(final String nextPageLink) {
return listByVpnSiteNextSinglePageAsync(nextPageLink)
.concatMap(new Func1>, Observable>>>() {
@Override
public Observable>> call(ServiceResponse> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByVpnSiteNextWithServiceResponseAsync(nextPageLink));
}
});
}
/**
* Lists all the vpnSiteLinks in a resource group for a vpn site.
*
ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<VpnSiteLinkInner> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable>> listByVpnSiteNextSinglePageAsync(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.listByVpnSiteNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1, Observable>>>() {
@Override
public Observable>> call(Response response) {
try {
ServiceResponse> result = listByVpnSiteNextDelegate(response);
return Observable.just(new ServiceResponse>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse> listByVpnSiteNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy