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.
/**
* 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.storage.implementation;
import retrofit2.Retrofit;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.CloudException;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponse;
import java.io.IOException;
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.Response;
import rx.functions.Func1;
import rx.Observable;
An instance of this class provides access to all the operations defined
in PrivateLinkResources.
/**
* An instance of this class provides access to all the operations defined
* in PrivateLinkResources.
*/
public class PrivateLinkResourcesInner {
The Retrofit service to perform REST calls. /** The Retrofit service to perform REST calls. */
private PrivateLinkResourcesService service;
The service client containing this operation class. /** The service client containing this operation class. */
private StorageManagementClientImpl client;
Initializes an instance of PrivateLinkResourcesInner.
Params: - retrofit – the Retrofit instance built from a Retrofit Builder.
- client – the instance of the service client containing this operation class.
/**
* Initializes an instance of PrivateLinkResourcesInner.
*
* @param retrofit the Retrofit instance built from a Retrofit Builder.
* @param client the instance of the service client containing this operation class.
*/
public PrivateLinkResourcesInner(Retrofit retrofit, StorageManagementClientImpl client) {
this.service = retrofit.create(PrivateLinkResourcesService.class);
this.client = client;
}
The interface defining all the services for PrivateLinkResources to be
used by Retrofit to perform actually REST calls.
/**
* The interface defining all the services for PrivateLinkResources to be
* used by Retrofit to perform actually REST calls.
*/
interface PrivateLinkResourcesService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.storage.PrivateLinkResources listByStorageAccount" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources")
Observable<Response<ResponseBody>> listByStorageAccount(@Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
}
Gets the private link resources that need to be created for a storage account.
Params: - resourceGroupName – The name of the resource group within the user's subscription. The name is case insensitive.
- accountName – The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
Throws: - IllegalArgumentException – thrown if parameters fail the validation
- CloudException – thrown if the request is rejected by server
- RuntimeException – all other wrapped checked exceptions if the request fails to be sent
Returns: the PrivateLinkResourceListResultInner object if successful.
/**
* Gets the private link resources that need to be created for a storage account.
*
* @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
* @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
* @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 PrivateLinkResourceListResultInner object if successful.
*/
public PrivateLinkResourceListResultInner listByStorageAccount(String resourceGroupName, String accountName) {
return listByStorageAccountWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body();
}
Gets the private link resources that need to be created for a storage account.
Params: - resourceGroupName – The name of the resource group within the user's subscription. The name is case insensitive.
- accountName – The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
- serviceCallback – the async ServiceCallback to handle successful and failed responses.
Throws: - IllegalArgumentException – thrown if parameters fail the validation
Returns: the ServiceFuture
object
/**
* Gets the private link resources that need to be created for a storage account.
*
* @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
* @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
* @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<PrivateLinkResourceListResultInner> listByStorageAccountAsync(String resourceGroupName, String accountName, final ServiceCallback<PrivateLinkResourceListResultInner> serviceCallback) {
return ServiceFuture.fromResponse(listByStorageAccountWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback);
}
Gets the private link resources that need to be created for a storage account.
Params: - resourceGroupName – The name of the resource group within the user's subscription. The name is case insensitive.
- accountName – The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
Throws: - IllegalArgumentException – thrown if parameters fail the validation
Returns: the observable to the PrivateLinkResourceListResultInner object
/**
* Gets the private link resources that need to be created for a storage account.
*
* @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
* @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PrivateLinkResourceListResultInner object
*/
public Observable<PrivateLinkResourceListResultInner> listByStorageAccountAsync(String resourceGroupName, String accountName) {
return listByStorageAccountWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1<ServiceResponse<PrivateLinkResourceListResultInner>, PrivateLinkResourceListResultInner>() {
@Override
public PrivateLinkResourceListResultInner call(ServiceResponse<PrivateLinkResourceListResultInner> response) {
return response.body();
}
});
}
Gets the private link resources that need to be created for a storage account.
Params: - resourceGroupName – The name of the resource group within the user's subscription. The name is case insensitive.
- accountName – The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
Throws: - IllegalArgumentException – thrown if parameters fail the validation
Returns: the observable to the PrivateLinkResourceListResultInner object
/**
* Gets the private link resources that need to be created for a storage account.
*
* @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
* @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PrivateLinkResourceListResultInner object
*/
public Observable<ServiceResponse<PrivateLinkResourceListResultInner>> listByStorageAccountWithServiceResponseAsync(String resourceGroupName, String accountName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (accountName == null) {
throw new IllegalArgumentException("Parameter accountName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.listByStorageAccount(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<PrivateLinkResourceListResultInner>>>() {
@Override
public Observable<ServiceResponse<PrivateLinkResourceListResultInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PrivateLinkResourceListResultInner> clientResponse = listByStorageAccountDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse<PrivateLinkResourceListResultInner> listByStorageAccountDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<PrivateLinkResourceListResultInner, CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<PrivateLinkResourceListResultInner>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
}