public async Task <Response <SearchIndexer> > CreateOrUpdateAsync(string indexerName, SearchIndexer indexer, string ifMatch = null, string ifNoneMatch = null, bool?disableCacheReprocessingChangeDetection = null, bool?ignoreResetRequirements = null, CancellationToken cancellationToken = default) { if (indexerName == null) { throw new ArgumentNullException(nameof(indexerName)); } if (indexer == null) { throw new ArgumentNullException(nameof(indexer)); } using var message = CreateCreateOrUpdateRequest(indexerName, indexer, ifMatch, ifNoneMatch, disableCacheReprocessingChangeDetection, ignoreResetRequirements); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: case 201: { SearchIndexer value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); value = SearchIndexer.DeserializeSearchIndexer(document.RootElement); return(Response.FromValue(value, message.Response)); }
public async ValueTask <Response <SearchIndexer> > CreateOrUpdateAsync(string indexerName, SearchIndexer indexer, Guid?xMsClientRequestId = null, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { if (indexerName == null) { throw new ArgumentNullException(nameof(indexerName)); } if (indexer == null) { throw new ArgumentNullException(nameof(indexer)); } using var message = CreateCreateOrUpdateRequest(indexerName, indexer, xMsClientRequestId, ifMatch, ifNoneMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: case 201: { SearchIndexer value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); if (document.RootElement.ValueKind == JsonValueKind.Null) { value = null; } else { value = SearchIndexer.DeserializeSearchIndexer(document.RootElement); } return(Response.FromValue(value, message.Response)); }