Skip to content

Commit

Permalink
Overloads for indexer (Azure#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
Humoiz authored Nov 13, 2019
1 parent 7593e39 commit d8259af
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,63 +359,43 @@ public Mono<Indexer> createOrUpdateIndexer(Indexer indexer) {
* Creates a new Azure Search indexer or updates an indexer if it already exists.
*
* @param indexer The definition of the indexer to create or update.
* @param requestOptions additional parameters for the operation.
* Contains the tracking ID sent with the request to help with debugging
* @param accessCondition the condition where the operation will be performed if the ETag on the server matches or
* doesn't match specified values
* @param requestOptions additional parameters for the operation.
* Contains the tracking ID sent with the request to help with debugging
* @return a response containing the created Indexer.
*/
public Mono<Indexer> createOrUpdateIndexer(Indexer indexer,
RequestOptions requestOptions,
AccessCondition accessCondition) {
return createOrUpdateIndexerWithResponse(
indexer,
requestOptions,
accessCondition)
AccessCondition accessCondition,
RequestOptions requestOptions) {
return this.createOrUpdateIndexerWithResponse(indexer, accessCondition, requestOptions)
.map(Response::getValue);
}

/**
* Creates a new Azure Search indexer or updates an indexer if it already exists.
*
* @param indexer The definition of the indexer to create or update.
* @param requestOptions additional parameters for the operation.
* Contains the tracking ID sent with the request to help with debugging
* @param indexer the definition of the indexer to create or update
* @param accessCondition the condition where the operation will be performed if the ETag on the server matches or
* doesn't match specified values
* @param requestOptions additional parameters for the operation
* Contains the tracking ID sent with the request to help with debugging
* @return a response containing the created Indexer.
*/
public Mono<Response<Indexer>> createOrUpdateIndexerWithResponse(Indexer indexer,
RequestOptions requestOptions,
AccessCondition accessCondition) {
return withContext(context -> createOrUpdateIndexerWithResponse(
indexer,
requestOptions,
accessCondition,
context));
AccessCondition accessCondition,
RequestOptions requestOptions) {
return withContext(context -> this.createOrUpdateIndexerWithResponse(indexer,
accessCondition, requestOptions, context));
}

/**
* Creates a new Azure Search indexer or updates an indexer if it already exists.
*
* @param indexer The definition of the indexer to create or update.
* @param requestOptions additional parameters for the operation.
* Contains the tracking ID sent with the request to help with debugging
* @param accessCondition the condition where the operation will be performed if the ETag on the server matches or
* doesn't match specified values
* @param context Context
* @return A response object containing the Indexer.
*/
Mono<Response<Indexer>> createOrUpdateIndexerWithResponse(Indexer indexer,
RequestOptions requestOptions,
AccessCondition accessCondition,
RequestOptions requestOptions,
Context context) {
return restClient.indexers().createOrUpdateWithRestResponseAsync(
indexer.getName(),
indexer,
requestOptions,
accessCondition,
context)
return restClient
.indexers()
.createOrUpdateWithRestResponseAsync(indexer.getName(), indexer, requestOptions, accessCondition, context)
.map(Function.identity());
}

Expand All @@ -442,7 +422,7 @@ public Mono<Response<Indexer>> getIndexerWithResponse() {
*/
public PagedFlux<Indexer> listIndexers() {
return new PagedFlux<>(
() -> listIndexersWithResponse(null, null),
() -> this.listIndexersWithResponse(null, null),
nextLink -> Mono.empty());
}

Expand All @@ -457,23 +437,7 @@ public PagedFlux<Indexer> listIndexers() {
*/
public PagedFlux<Indexer> listIndexers(String select, RequestOptions requestOptions) {
return new PagedFlux<>(
() -> listIndexersWithResponse(select, requestOptions),
nextLink -> Mono.empty());
}

/**
* Lists all indexers available for an Azure Search service.
*
* @param select Selects which top-level properties of the indexers to retrieve.
* Specified as a comma-separated list of JSON property names, or '*' for all properties.
* The default is all properties.
* @param requestOptions Additional parameters for the operation.
* @param context The context to associate with this operation.
* @return a response containing all Indexers from the Search service.
*/
PagedFlux<Indexer> listIndexers(String select, RequestOptions requestOptions, Context context) {
return new PagedFlux<>(
() -> listIndexersWithResponse(select, requestOptions, context),
() -> this.listIndexersWithResponse(select, requestOptions),
nextLink -> Mono.empty());
}

Expand All @@ -487,19 +451,9 @@ PagedFlux<Indexer> listIndexers(String select, RequestOptions requestOptions, Co
* @return a response containing all Indexers from the Search service.
*/
public Mono<PagedResponse<Indexer>> listIndexersWithResponse(String select, RequestOptions requestOptions) {
return withContext(context -> listIndexersWithResponse(select, requestOptions, context));
return withContext(context -> this.listIndexersWithResponse(select, requestOptions, context));
}

/**
* Lists all indexers available for an Azure Search service.
*
* @param select Selects which top-level properties of the indexers to retrieve.
* Specified as a comma-separated list of JSON property names, or '*' for all properties.
* The default is all properties.
* @param requestOptions Additional parameters for the operation.
* @param context The context to associate with this operation.
* @return a response containing all Indexers from the Search service.
*/
Mono<PagedResponse<Indexer>> listIndexersWithResponse(String select,
RequestOptions requestOptions,
Context context) {
Expand Down Expand Up @@ -568,15 +522,15 @@ public Mono<Response<Response<Void>>> runIndexerWithResponse() {
* @return the Indexer execution information.
* @throws NotImplementedException not implemented
*/
public Mono<IndexerExecutionInfo> deleteIndexerStatus() {
public Mono<IndexerExecutionInfo> getIndexerStatus() {
throw logger.logExceptionAsError(new NotImplementedException("not implemented."));
}

/**
* @return a response containing the Indexer execution information.
* @throws NotImplementedException not implemented
*/
public Mono<Response<IndexerExecutionInfo>> deleteIndexerStatusWithResponse() {
public Mono<Response<IndexerExecutionInfo>> getIndexerStatusWithResponse() {
throw logger.logExceptionAsError(new NotImplementedException("not implemented."));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,42 +267,34 @@ public Indexer createOrUpdateIndexer(Indexer indexer) {
* Creates a new Azure Search indexer or updates an indexer if it already exists.
*
* @param indexer The definition of the indexer to create or update.
* @param requestOptions additional parameters for the operation.
* Contains the tracking ID sent with the request to help with debugging
* @param accessCondition the condition where the operation will be performed if the ETag on the server matches or
* doesn't match specified values
* @param requestOptions additional parameters for the operation.
* Contains the tracking ID sent with the request to help with debugging
* @return a response containing the created Indexer.
*/
public Indexer createOrUpdateIndexer(Indexer indexer,
RequestOptions requestOptions,
AccessCondition accessCondition) {
return asyncClient.createOrUpdateIndexer(
indexer,
requestOptions,
accessCondition).block();
AccessCondition accessCondition,
RequestOptions requestOptions) {
return asyncClient.createOrUpdateIndexer(indexer, accessCondition, requestOptions).block();
}

/**
* Creates a new Azure Search indexer or updates an indexer if it already exists.
*
* @param indexer The definition of the indexer to create or update.
* @param requestOptions additional parameters for the operation.
* Contains the tracking ID sent with the request to help with debugging
* @param accessCondition the condition where the operation will be performed if the ETag on the server matches or
* doesn't match specified values
* @param requestOptions additional parameters for the operation.
* Contains the tracking ID sent with the request to help with debugging
* @param context Context
* @return A response object containing the Indexer.
*/
public Response<Indexer> createOrUpdateIndexerWithResponse(Indexer indexer,
RequestOptions requestOptions,
AccessCondition accessCondition,
RequestOptions requestOptions,
Context context) {
return asyncClient.createOrUpdateIndexerWithResponse(
indexer,
requestOptions,
accessCondition,
context)
.block();
return asyncClient.createOrUpdateIndexerWithResponse(indexer, accessCondition, requestOptions, context).block();
}

/**
Expand All @@ -319,11 +311,10 @@ public PagedIterable<Indexer> listIndexers() {
* Specified as a comma-separated list of JSON property names, or '*' for all properties.
* The default is all properties.
* @param requestOptions Additional parameters for the operation.
* @param context The context to associate with this operation.
* @return all Indexers from the Search service.
*/
public PagedIterable<Indexer> listIndexers(String select, RequestOptions requestOptions, Context context) {
return new PagedIterable<>(asyncClient.listIndexers(select, requestOptions, context));
public PagedIterable<Indexer> listIndexers(String select, RequestOptions requestOptions) {
return new PagedIterable<>(asyncClient.listIndexers(select, requestOptions));
}

/**
Expand Down Expand Up @@ -407,15 +398,15 @@ public Response<Response<Void>> runIndexerWithResponse() {
* @return the Indexer execution information.
* @throws NotImplementedException not implemented
*/
public IndexerExecutionInfo deleteIndexerStatus() {
public IndexerExecutionInfo getIndexerStatus() {
throw logger.logExceptionAsError(new NotImplementedException("not implemented."));
}

/**
* @return a response containing the Indexer execution information.
* @throws NotImplementedException not implemented
*/
public Response<IndexerExecutionInfo> deleteIndexerStatusWithResponse() {
public Response<IndexerExecutionInfo> getIndexerStatusWithResponse() {
throw logger.logExceptionAsError(new NotImplementedException("not implemented."));
}

Expand Down

0 comments on commit d8259af

Please sign in to comment.