com.microsoft.azure.management.search.implementation.QueryKeysInner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-mgmt-search Show documentation
Show all versions of azure-mgmt-search Show documentation
This package contains Microsoft Azure Search Management SDK.
/**
* 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.search.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 com.microsoft.rest.Validator;
import java.io.IOException;
import java.util.List;
import java.util.UUID;
import okhttp3.ResponseBody;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.HTTP;
import retrofit2.http.Path;
import retrofit2.http.POST;
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 QueryKeys.
*/
public class QueryKeysInner {
/** The Retrofit service to perform REST calls. */
private QueryKeysService service;
/** The service client containing this operation class. */
private SearchManagementClientImpl client;
/**
* Initializes an instance of QueryKeysInner.
*
* @param retrofit the Retrofit instance built from a Retrofit Builder.
* @param client the instance of the service client containing this operation class.
*/
public QueryKeysInner(Retrofit retrofit, SearchManagementClientImpl client) {
this.service = retrofit.create(QueryKeysService.class);
this.client = client;
}
/**
* The interface defining all the services for QueryKeys to be
* used by Retrofit to perform actually REST calls.
*/
interface QueryKeysService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.search.QueryKeys create" })
@POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}")
Observable> create(@Path("resourceGroupName") String resourceGroupName, @Path("searchServiceName") String searchServiceName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.search.QueryKeys listBySearchService" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys")
Observable> listBySearchService(@Path("resourceGroupName") String resourceGroupName, @Path("searchServiceName") String searchServiceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.search.QueryKeys delete" })
@HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}", method = "DELETE", hasBody = true)
Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("searchServiceName") String searchServiceName, @Path("key") String key, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("x-ms-client-request-id") UUID clientRequestId, @Header("User-Agent") String userAgent);
}
/**
* Generates a new query key for the specified Search service. You can create up to 50 query keys per service.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param name The name of the new query API key.
* @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 QueryKeyInner object if successful.
*/
public QueryKeyInner create(String resourceGroupName, String searchServiceName, String name) {
return createWithServiceResponseAsync(resourceGroupName, searchServiceName, name).toBlocking().single().body();
}
/**
* Generates a new query key for the specified Search service. You can create up to 50 query keys per service.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param name The name of the new query API key.
* @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 createAsync(String resourceGroupName, String searchServiceName, String name, final ServiceCallback serviceCallback) {
return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, searchServiceName, name), serviceCallback);
}
/**
* Generates a new query key for the specified Search service. You can create up to 50 query keys per service.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param name The name of the new query API key.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the QueryKeyInner object
*/
public Observable createAsync(String resourceGroupName, String searchServiceName, String name) {
return createWithServiceResponseAsync(resourceGroupName, searchServiceName, name).map(new Func1, QueryKeyInner>() {
@Override
public QueryKeyInner call(ServiceResponse response) {
return response.body();
}
});
}
/**
* Generates a new query key for the specified Search service. You can create up to 50 query keys per service.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param name The name of the new query API key.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the QueryKeyInner object
*/
public Observable> createWithServiceResponseAsync(String resourceGroupName, String searchServiceName, String name) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (searchServiceName == null) {
throw new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name 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.");
}
final SearchManagementRequestOptionsInner searchManagementRequestOptions = null;
UUID clientRequestId = null;
return service.create(resourceGroupName, searchServiceName, name, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponse clientResponse = createDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
/**
* Generates a new query key for the specified Search service. You can create up to 50 query keys per service.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param name The name of the new query API key.
* @param searchManagementRequestOptions Additional parameters for the 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 QueryKeyInner object if successful.
*/
public QueryKeyInner create(String resourceGroupName, String searchServiceName, String name, SearchManagementRequestOptionsInner searchManagementRequestOptions) {
return createWithServiceResponseAsync(resourceGroupName, searchServiceName, name, searchManagementRequestOptions).toBlocking().single().body();
}
/**
* Generates a new query key for the specified Search service. You can create up to 50 query keys per service.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param name The name of the new query API key.
* @param searchManagementRequestOptions Additional parameters for the operation
* @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 createAsync(String resourceGroupName, String searchServiceName, String name, SearchManagementRequestOptionsInner searchManagementRequestOptions, final ServiceCallback serviceCallback) {
return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceGroupName, searchServiceName, name, searchManagementRequestOptions), serviceCallback);
}
/**
* Generates a new query key for the specified Search service. You can create up to 50 query keys per service.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param name The name of the new query API key.
* @param searchManagementRequestOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the QueryKeyInner object
*/
public Observable createAsync(String resourceGroupName, String searchServiceName, String name, SearchManagementRequestOptionsInner searchManagementRequestOptions) {
return createWithServiceResponseAsync(resourceGroupName, searchServiceName, name, searchManagementRequestOptions).map(new Func1, QueryKeyInner>() {
@Override
public QueryKeyInner call(ServiceResponse response) {
return response.body();
}
});
}
/**
* Generates a new query key for the specified Search service. You can create up to 50 query keys per service.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param name The name of the new query API key.
* @param searchManagementRequestOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the QueryKeyInner object
*/
public Observable> createWithServiceResponseAsync(String resourceGroupName, String searchServiceName, String name, SearchManagementRequestOptionsInner searchManagementRequestOptions) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (searchServiceName == null) {
throw new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name 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.");
}
Validator.validate(searchManagementRequestOptions);
UUID clientRequestId = null;
if (searchManagementRequestOptions != null) {
clientRequestId = searchManagementRequestOptions.clientRequestId();
}
return service.create(resourceGroupName, searchServiceName, name, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponse clientResponse = createDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse createDelegate(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);
}
/**
* Returns the list of query API keys for the given Azure Search service.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @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 List<QueryKeyInner> object if successful.
*/
public List listBySearchService(String resourceGroupName, String searchServiceName) {
return listBySearchServiceWithServiceResponseAsync(resourceGroupName, searchServiceName).toBlocking().single().body();
}
/**
* Returns the list of query API keys for the given Azure Search service.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @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> listBySearchServiceAsync(String resourceGroupName, String searchServiceName, final ServiceCallback> serviceCallback) {
return ServiceFuture.fromResponse(listBySearchServiceWithServiceResponseAsync(resourceGroupName, searchServiceName), serviceCallback);
}
/**
* Returns the list of query API keys for the given Azure Search service.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the List<QueryKeyInner> object
*/
public Observable> listBySearchServiceAsync(String resourceGroupName, String searchServiceName) {
return listBySearchServiceWithServiceResponseAsync(resourceGroupName, searchServiceName).map(new Func1>, List>() {
@Override
public List call(ServiceResponse> response) {
return response.body();
}
});
}
/**
* Returns the list of query API keys for the given Azure Search service.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the List<QueryKeyInner> object
*/
public Observable>> listBySearchServiceWithServiceResponseAsync(String resourceGroupName, String searchServiceName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (searchServiceName == null) {
throw new IllegalArgumentException("Parameter searchServiceName 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.");
}
final SearchManagementRequestOptionsInner searchManagementRequestOptions = null;
UUID clientRequestId = null;
return service.listBySearchService(resourceGroupName, searchServiceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent())
.flatMap(new Func1, Observable>>>() {
@Override
public Observable>> call(Response response) {
try {
ServiceResponse> result = listBySearchServiceDelegate(response);
ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response());
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
/**
* Returns the list of query API keys for the given Azure Search service.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param searchManagementRequestOptions Additional parameters for the 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 List<QueryKeyInner> object if successful.
*/
public List listBySearchService(String resourceGroupName, String searchServiceName, SearchManagementRequestOptionsInner searchManagementRequestOptions) {
return listBySearchServiceWithServiceResponseAsync(resourceGroupName, searchServiceName, searchManagementRequestOptions).toBlocking().single().body();
}
/**
* Returns the list of query API keys for the given Azure Search service.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param searchManagementRequestOptions Additional parameters for the operation
* @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> listBySearchServiceAsync(String resourceGroupName, String searchServiceName, SearchManagementRequestOptionsInner searchManagementRequestOptions, final ServiceCallback> serviceCallback) {
return ServiceFuture.fromResponse(listBySearchServiceWithServiceResponseAsync(resourceGroupName, searchServiceName, searchManagementRequestOptions), serviceCallback);
}
/**
* Returns the list of query API keys for the given Azure Search service.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param searchManagementRequestOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the List<QueryKeyInner> object
*/
public Observable> listBySearchServiceAsync(String resourceGroupName, String searchServiceName, SearchManagementRequestOptionsInner searchManagementRequestOptions) {
return listBySearchServiceWithServiceResponseAsync(resourceGroupName, searchServiceName, searchManagementRequestOptions).map(new Func1>, List>() {
@Override
public List call(ServiceResponse> response) {
return response.body();
}
});
}
/**
* Returns the list of query API keys for the given Azure Search service.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param searchManagementRequestOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the List<QueryKeyInner> object
*/
public Observable>> listBySearchServiceWithServiceResponseAsync(String resourceGroupName, String searchServiceName, SearchManagementRequestOptionsInner searchManagementRequestOptions) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (searchServiceName == null) {
throw new IllegalArgumentException("Parameter searchServiceName 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.");
}
Validator.validate(searchManagementRequestOptions);
UUID clientRequestId = null;
if (searchManagementRequestOptions != null) {
clientRequestId = searchManagementRequestOptions.clientRequestId();
}
return service.listBySearchService(resourceGroupName, searchServiceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent())
.flatMap(new Func1, Observable>>>() {
@Override
public Observable>> call(Response response) {
try {
ServiceResponse> result = listBySearchServiceDelegate(response);
ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response());
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse> listBySearchServiceDelegate(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);
}
/**
* Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param key The query key to be deleted. Query keys are identified by value, not by name.
* @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
*/
public void delete(String resourceGroupName, String searchServiceName, String key) {
deleteWithServiceResponseAsync(resourceGroupName, searchServiceName, key).toBlocking().single().body();
}
/**
* Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param key The query key to be deleted. Query keys are identified by value, not by name.
* @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 deleteAsync(String resourceGroupName, String searchServiceName, String key, final ServiceCallback serviceCallback) {
return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, searchServiceName, key), serviceCallback);
}
/**
* Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param key The query key to be deleted. Query keys are identified by value, not by name.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable deleteAsync(String resourceGroupName, String searchServiceName, String key) {
return deleteWithServiceResponseAsync(resourceGroupName, searchServiceName, key).map(new Func1, Void>() {
@Override
public Void call(ServiceResponse response) {
return response.body();
}
});
}
/**
* Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param key The query key to be deleted. Query keys are identified by value, not by name.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String searchServiceName, String key) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (searchServiceName == null) {
throw new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.");
}
if (key == null) {
throw new IllegalArgumentException("Parameter key 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.");
}
final SearchManagementRequestOptionsInner searchManagementRequestOptions = null;
UUID clientRequestId = null;
return service.delete(resourceGroupName, searchServiceName, key, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponse clientResponse = deleteDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
/**
* Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param key The query key to be deleted. Query keys are identified by value, not by name.
* @param searchManagementRequestOptions Additional parameters for the 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
*/
public void delete(String resourceGroupName, String searchServiceName, String key, SearchManagementRequestOptionsInner searchManagementRequestOptions) {
deleteWithServiceResponseAsync(resourceGroupName, searchServiceName, key, searchManagementRequestOptions).toBlocking().single().body();
}
/**
* Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param key The query key to be deleted. Query keys are identified by value, not by name.
* @param searchManagementRequestOptions Additional parameters for the operation
* @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 deleteAsync(String resourceGroupName, String searchServiceName, String key, SearchManagementRequestOptionsInner searchManagementRequestOptions, final ServiceCallback serviceCallback) {
return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, searchServiceName, key, searchManagementRequestOptions), serviceCallback);
}
/**
* Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param key The query key to be deleted. Query keys are identified by value, not by name.
* @param searchManagementRequestOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable deleteAsync(String resourceGroupName, String searchServiceName, String key, SearchManagementRequestOptionsInner searchManagementRequestOptions) {
return deleteWithServiceResponseAsync(resourceGroupName, searchServiceName, key, searchManagementRequestOptions).map(new Func1, Void>() {
@Override
public Void call(ServiceResponse response) {
return response.body();
}
});
}
/**
* Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it.
*
* @param resourceGroupName The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal.
* @param searchServiceName The name of the Azure Search service associated with the specified resource group.
* @param key The query key to be deleted. Query keys are identified by value, not by name.
* @param searchManagementRequestOptions Additional parameters for the operation
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String searchServiceName, String key, SearchManagementRequestOptionsInner searchManagementRequestOptions) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (searchServiceName == null) {
throw new IllegalArgumentException("Parameter searchServiceName is required and cannot be null.");
}
if (key == null) {
throw new IllegalArgumentException("Parameter key 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.");
}
Validator.validate(searchManagementRequestOptions);
UUID clientRequestId = null;
if (searchManagementRequestOptions != null) {
clientRequestId = searchManagementRequestOptions.clientRequestId();
}
return service.delete(resourceGroupName, searchServiceName, key, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), clientRequestId, this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponse clientResponse = deleteDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
.register(200, new TypeToken() { }.getType())
.register(204, new TypeToken() { }.getType())
.register(404, new TypeToken() { }.getType())
.registerError(CloudException.class)
.build(response);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy