From 2db109ba65cc5c90217efed75ac3c65b914f8da5 Mon Sep 17 00:00:00 2001
From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com>
Date: Fri, 28 Aug 2020 11:41:49 -0700
Subject: [PATCH 001/168] Increment package version after release of com.azure
azure-ai-anomalydetector (#14549)
---
eng/jacoco-test-coverage/pom.xml | 2 +-
eng/versioning/version_client.txt | 2 +-
sdk/anomalydetector/azure-ai-anomalydetector/CHANGELOG.md | 3 +++
sdk/anomalydetector/azure-ai-anomalydetector/pom.xml | 2 +-
4 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/eng/jacoco-test-coverage/pom.xml b/eng/jacoco-test-coverage/pom.xml
index e9e28fc926299..1a46c99bc574a 100644
--- a/eng/jacoco-test-coverage/pom.xml
+++ b/eng/jacoco-test-coverage/pom.xml
@@ -39,7 +39,7 @@
com.azureazure-ai-anomalydetector
- 3.0.0-beta.1
+ 3.0.0-beta.2com.azure
diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt
index bd8287ab39a29..a474c545f184b 100644
--- a/eng/versioning/version_client.txt
+++ b/eng/versioning/version_client.txt
@@ -4,7 +4,7 @@
com.azure:azure-sdk-all;1.0.0;1.0.0
com.azure:azure-sdk-parent;1.6.0;1.6.0
com.azure:azure-client-sdk-parent;1.7.0;1.7.0
-com.azure:azure-ai-anomalydetector;1.0.0-beta.1;3.0.0-beta.1
+com.azure:azure-ai-anomalydetector;3.0.0-beta.1;3.0.0-beta.2
com.azure:azure-ai-formrecognizer;3.0.0;3.1.0-beta.1
com.azure:azure-ai-textanalytics;5.0.0;5.1.0-beta.1
com.azure:azure-core;1.7.0;1.8.0-beta.1
diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/CHANGELOG.md b/sdk/anomalydetector/azure-ai-anomalydetector/CHANGELOG.md
index d6fa0436bb8bc..2283b6f8619dc 100644
--- a/sdk/anomalydetector/azure-ai-anomalydetector/CHANGELOG.md
+++ b/sdk/anomalydetector/azure-ai-anomalydetector/CHANGELOG.md
@@ -1,5 +1,8 @@
# Release History
+## 3.0.0-beta.2 (Unreleased)
+
+
## 3.0.0-beta.1 (2020-08-27)
- Change version to 3.0.0-beta.1
diff --git a/sdk/anomalydetector/azure-ai-anomalydetector/pom.xml b/sdk/anomalydetector/azure-ai-anomalydetector/pom.xml
index 2cf591bcf8378..7ce431082b526 100644
--- a/sdk/anomalydetector/azure-ai-anomalydetector/pom.xml
+++ b/sdk/anomalydetector/azure-ai-anomalydetector/pom.xml
@@ -11,7 +11,7 @@
com.azureazure-ai-anomalydetector
- 3.0.0-beta.1
+ 3.0.0-beta.2Microsoft Azure client library for Anomaly DetectorThis package contains Microsoft Azure Anomaly Detector client library.
From 5843d992409a7db0a26b73caba93d1d7bdd52d23 Mon Sep 17 00:00:00 2001
From: Shawn Fang <45607042+mssfang@users.noreply.github.com>
Date: Fri, 28 Aug 2020 14:48:32 -0700
Subject: [PATCH 002/168] TA add "opinion mining" new feature (#13333)
Added "opinion mining" new feature implementation
---
.../azure-ai-textanalytics/CHANGELOG.md | 6 +-
.../azure-ai-textanalytics/pom.xml | 6 +
.../AnalyzeSentimentAsyncClient.java | 160 +++++++++++-
.../TextAnalyticsAsyncClient.java | 155 +++++++++--
.../ai/textanalytics/TextAnalyticsClient.java | 151 +++++++++--
.../TextAnalyticsClientBuilder.java | 6 +-
.../textanalytics/implementation/Utility.java | 2 +-
.../models/AnalyzeSentimentOptions.java | 73 ++++++
.../textanalytics/models/AspectSentiment.java | 86 +++++++
.../ai/textanalytics/models/MinedOpinion.java | 45 ++++
.../models/OpinionSentiment.java | 97 +++++++
.../models/SentenceSentiment.java | 39 ++-
.../models/TextAnalyticsRequestOptions.java | 7 +-
.../AnalyzeSentimentWithOpinionMining.java | 56 ++++
...nalyzeSentimentWithOpinionMiningAsync.java | 68 +++++
...alyticsAsyncClientJavaDocCodeSnippets.java | 151 +++++++++--
...extAnalyticsClientJavaDocCodeSnippets.java | 112 +++++++-
...timentBatchDocumentsWithOpinionMining.java | 95 +++++++
...tBatchDocumentsWithOpinionMiningAsync.java | 105 ++++++++
...SentimentBatchStringWithOpinionMining.java | 78 ++++++
...mentBatchStringWithOpinionMiningAsync.java | 100 ++++++++
.../textanalytics/DocumentInputAsyncTest.java | 8 +-
.../ai/textanalytics/DocumentInputTest.java | 8 +-
.../ReferencePointerParseTest.java | 136 ++++++++++
.../com/azure/ai/textanalytics/TestUtils.java | 147 +++++++----
.../TextAnalyticsAsyncClientTest.java | 240 +++++++++++++++---
.../TextAnalyticsClientTest.java | 231 +++++++++++++----
.../TextAnalyticsClientTestBase.java | 164 ++++++++++--
.../org.mockito.plugins.MockMaker | 1 +
.../analyzeSentimentDuplicateIdInput.json | 12 +-
...ShowStatisticsButIncludeOpinionMining.json | 26 ++
...eSentimentForBatchInputShowStatistics.json | 12 +-
...ShowStatisticsAndIncludeOpinionMining.json | 26 ++
...utShowStatisticsExcludeOpinionMining.json} | 12 +-
...InputWithNullAnalyzeSentimentOptions.json} | 10 +-
...tForBatchInputWithNullRequestOptions.json} | 12 +-
.../analyzeSentimentForBatchStringInput.json | 12 +-
.../analyzeSentimentForEmptyText.json | 10 +-
.../analyzeSentimentForFaultyText.json | 10 +-
...ShowStatisticsButIncludeOpinionMining.json | 26 ++
...ShowStatisticsAndIncludeOpinionMining.json | 26 ++
...ingShowStatisticsExcludeOpinionMining.json | 26 ++
...entimentForListStringWithLanguageHint.json | 26 ++
.../analyzeSentimentForTextInput.json | 10 +-
...ntForTextInputWithDefaultLanguageHint.json | 26 ++
...entimentForTextInputWithOpinionMining.json | 26 ++
46 files changed, 2523 insertions(+), 318 deletions(-)
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AnalyzeSentimentOptions.java
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AspectSentiment.java
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/MinedOpinion.java
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/OpinionSentiment.java
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentWithOpinionMining.java
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentWithOpinionMiningAsync.java
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocumentsWithOpinionMining.java
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocumentsWithOpinionMiningAsync.java
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchStringWithOpinionMining.java
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchStringWithOpinionMiningAsync.java
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/ReferencePointerParseTest.java
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputNotShowStatisticsButIncludeOpinionMining.json
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatisticsAndIncludeOpinionMining.json
rename sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/{analyzeSentimentForListStringWithOptions.json => analyzeSentimentForBatchInputShowStatisticsExcludeOpinionMining.json} (84%)
rename sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/{analyzeSentimentForBatchInput.json => analyzeSentimentForBatchInputWithNullAnalyzeSentimentOptions.json} (85%)
rename sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/{analyzeSentimentForListLanguageHint.json => analyzeSentimentForBatchInputWithNullRequestOptions.json} (82%)
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringNotShowStatisticsButIncludeOpinionMining.json
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringShowStatisticsAndIncludeOpinionMining.json
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringShowStatisticsExcludeOpinionMining.json
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringWithLanguageHint.json
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInputWithDefaultLanguageHint.json
create mode 100644 sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInputWithOpinionMining.json
diff --git a/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md b/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md
index 53218448ed0fb..c2f904541e273 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md
+++ b/sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md
@@ -5,9 +5,13 @@
- `offset` is the offset of the text from the start of the document
**New features**
+- Updated Text Analytics SDK's default service API version to `v3.1-preview.1` from `v3.0`.
- Added support for Personally Identifiable Information(PII) entity recognition feature.
To use this feature, you need to make sure you are using the service's v3.1-preview.1 API.
-
+- Added support for the Opinion Mining feature. To use this feature, you need to make sure you are using the
+service's v3.1-preview.1 and above API. To get this support pass `includeOpinionMining` as `true` in
+`AnalyzeSentimentOptions` when calling the sentiment analysis endpoints.
+
## 5.0.0 (2020-07-27)
- Re-release of version `1.0.1` with updated version `5.0.0`.
diff --git a/sdk/textanalytics/azure-ai-textanalytics/pom.xml b/sdk/textanalytics/azure-ai-textanalytics/pom.xml
index 8591f86c20d42..29bb4fcf531ef 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/pom.xml
+++ b/sdk/textanalytics/azure-ai-textanalytics/pom.xml
@@ -91,5 +91,11 @@
1.1.0test
+
+ org.mockito
+ mockito-core
+ 3.3.3
+ test
+
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeSentimentAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeSentimentAsyncClient.java
index 9dfb8eee2a07c..176c441ec8478 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeSentimentAsyncClient.java
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/AnalyzeSentimentAsyncClient.java
@@ -4,18 +4,26 @@
package com.azure.ai.textanalytics;
import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl;
+import com.azure.ai.textanalytics.implementation.Utility;
+import com.azure.ai.textanalytics.implementation.models.AspectConfidenceScoreLabel;
+import com.azure.ai.textanalytics.implementation.models.AspectRelationType;
import com.azure.ai.textanalytics.implementation.models.DocumentError;
import com.azure.ai.textanalytics.implementation.models.DocumentSentiment;
import com.azure.ai.textanalytics.implementation.models.DocumentSentimentValue;
import com.azure.ai.textanalytics.implementation.models.MultiLanguageBatchInput;
+import com.azure.ai.textanalytics.implementation.models.SentenceAspect;
+import com.azure.ai.textanalytics.implementation.models.SentenceOpinion;
import com.azure.ai.textanalytics.implementation.models.SentenceSentimentValue;
import com.azure.ai.textanalytics.implementation.models.SentimentConfidenceScorePerLabel;
import com.azure.ai.textanalytics.implementation.models.SentimentResponse;
import com.azure.ai.textanalytics.implementation.models.WarningCodeValue;
+import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions;
import com.azure.ai.textanalytics.models.AnalyzeSentimentResult;
+import com.azure.ai.textanalytics.models.AspectSentiment;
+import com.azure.ai.textanalytics.models.MinedOpinion;
+import com.azure.ai.textanalytics.models.OpinionSentiment;
import com.azure.ai.textanalytics.models.SentenceSentiment;
import com.azure.ai.textanalytics.models.SentimentConfidenceScores;
-import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions;
import com.azure.ai.textanalytics.models.TextAnalyticsWarning;
import com.azure.ai.textanalytics.models.TextDocumentInput;
import com.azure.ai.textanalytics.models.TextSentiment;
@@ -30,6 +38,8 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static com.azure.ai.textanalytics.TextAnalyticsAsyncClient.COGNITIVE_TRACING_NAMESPACE_VALUE;
@@ -47,6 +57,7 @@
* Helper class for managing sentiment analysis endpoint.
*/
class AnalyzeSentimentAsyncClient {
+ private static final int NEUTRAL_SCORE_ZERO = 0;
private final ClientLogger logger = new ClientLogger(AnalyzeSentimentAsyncClient.class);
private final TextAnalyticsClientImpl service;
@@ -65,12 +76,16 @@ class AnalyzeSentimentAsyncClient {
* which contains {@link AnalyzeSentimentResultCollection}.
*
* @param documents The list of documents to analyze sentiments for.
- * @param options The {@link TextAnalyticsRequestOptions} request options.
+ * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when
+ * analyzing sentiments.
*
* @return A mono {@link Response} contains {@link AnalyzeSentimentResultCollection}.
+ *
+ * @throws NullPointerException if {@code documents} is null.
+ * @throws IllegalArgumentException if {@code documents} is empty.
*/
public Mono> analyzeSentimentBatch(
- Iterable documents, TextAnalyticsRequestOptions options) {
+ Iterable documents, AnalyzeSentimentOptions options) {
try {
inputDocumentsValidation(documents);
return withContext(context -> getAnalyzedSentimentResponse(documents, options, context));
@@ -84,13 +99,14 @@ public Mono> analyzeSentimentBatch(
* which contains {@link AnalyzeSentimentResultCollection}.
*
* @param documents The list of documents to analyze sentiments for.
- * @param options The {@link TextAnalyticsRequestOptions} request options.
+ * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when
+ * analyzing sentiments.
* @param context Additional context that is passed through the Http pipeline during the service call.
*
* @return A mono {@link Response} contains {@link AnalyzeSentimentResultCollection}.
*/
Mono> analyzeSentimentBatchWithContext(
- Iterable documents, TextAnalyticsRequestOptions options, Context context) {
+ Iterable documents, AnalyzeSentimentOptions options, Context context) {
try {
inputDocumentsValidation(documents);
return getAnalyzedSentimentResponse(documents, options, context);
@@ -111,8 +127,9 @@ private Response toAnalyzeSentimentResultColle
Response response) {
final SentimentResponse sentimentResponse = response.getValue();
final List analyzeSentimentResults = new ArrayList<>();
- for (DocumentSentiment documentSentiment : sentimentResponse.getDocuments()) {
- analyzeSentimentResults.add(convertToAnalyzeSentimentResult(documentSentiment));
+ final List documentSentiments = sentimentResponse.getDocuments();
+ for (DocumentSentiment documentSentiment : documentSentiments) {
+ analyzeSentimentResults.add(convertToAnalyzeSentimentResult(documentSentiment, documentSentiments));
}
for (DocumentError documentError : sentimentResponse.getErrors()) {
analyzeSentimentResults.add(new AnalyzeSentimentResult(documentError.getId(), null,
@@ -127,10 +144,12 @@ private Response toAnalyzeSentimentResultColle
* Helper method to convert the service response of {@link DocumentSentiment} to {@link AnalyzeSentimentResult}.
*
* @param documentSentiment The {@link DocumentSentiment} returned by the service.
+ * @param documentSentimentList The document sentiment list returned by the service.
*
* @return The {@link AnalyzeSentimentResult} to be returned by the SDK.
*/
- private AnalyzeSentimentResult convertToAnalyzeSentimentResult(DocumentSentiment documentSentiment) {
+ private AnalyzeSentimentResult convertToAnalyzeSentimentResult(DocumentSentiment documentSentiment,
+ List documentSentimentList) {
// Document text sentiment
final SentimentConfidenceScorePerLabel confidenceScorePerLabel = documentSentiment.getConfidenceScores();
// Sentence text sentiment
@@ -141,8 +160,10 @@ private AnalyzeSentimentResult convertToAnalyzeSentimentResult(DocumentSentiment
final SentenceSentimentValue sentenceSentimentValue = sentenceSentiment.getSentiment();
return new SentenceSentiment(sentenceSentiment.getText(),
TextSentiment.fromString(sentenceSentimentValue == null ? null : sentenceSentimentValue.toString()),
+ toMinedOpinionList(sentenceSentiment, documentSentimentList),
new SentimentConfidenceScores(confidenceScorePerSentence.getNegative(),
- confidenceScorePerSentence.getNeutral(), confidenceScorePerSentence.getPositive()));
+ confidenceScorePerSentence.getNeutral(), confidenceScorePerSentence.getPositive())
+ );
}).collect(Collectors.toList());
// Warnings
@@ -175,24 +196,135 @@ private AnalyzeSentimentResult convertToAnalyzeSentimentResult(DocumentSentiment
* {@link AnalyzeSentimentResultCollection} from a {@link SimpleResponse} of {@link SentimentResponse}.
*
* @param documents A list of documents to be analyzed.
- * @param options The {@link TextAnalyticsRequestOptions} request options.
+ * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when
+ * analyzing sentiments.
* @param context Additional context that is passed through the Http pipeline during the service call.
*
* @return A mono {@link Response} contains {@link AnalyzeSentimentResultCollection}.
*/
private Mono> getAnalyzedSentimentResponse(
- Iterable documents, TextAnalyticsRequestOptions options, Context context) {
- // TODO: add opinion mining in the following PR
+ Iterable documents, AnalyzeSentimentOptions options, Context context) {
return service.sentimentWithResponseAsync(
new MultiLanguageBatchInput().setDocuments(toMultiLanguageInput(documents)),
options == null ? null : options.getModelVersion(),
options == null ? null : options.isIncludeStatistics(),
- null,
+ options == null ? null : options.isIncludeOpinionMining(),
context.addData(AZ_TRACING_NAMESPACE_KEY, COGNITIVE_TRACING_NAMESPACE_VALUE))
.doOnSubscribe(ignoredValue -> logger.info("A batch of documents - {}", documents.toString()))
.doOnSuccess(response -> logger.info("Analyzed sentiment for a batch of documents - {}", response))
.doOnError(error -> logger.warning("Failed to analyze sentiment - {}", error))
.map(this::toAnalyzeSentimentResultCollectionResponse)
- .onErrorMap(throwable -> mapToHttpResponseExceptionIfExist(throwable));
+ .onErrorMap(Utility::mapToHttpResponseExceptionIfExist);
+ }
+
+ /*
+ * Transform SentenceSentiment's opinion mining to output that user can use.
+ */
+ private IterableStream toMinedOpinionList(
+ com.azure.ai.textanalytics.implementation.models.SentenceSentiment sentenceSentiment,
+ List documentSentimentList) {
+ // If include opinion mining indicator is false, the service return null for the aspect list.
+ final List sentenceAspects = sentenceSentiment.getAspects();
+ if (sentenceAspects == null) {
+ return null;
+ }
+ final List minedOpinions = new ArrayList<>();
+ sentenceAspects.forEach(sentenceAspect -> {
+ final List opinionSentiments = new ArrayList<>();
+ sentenceAspect.getRelations().forEach(aspectRelation -> {
+ final AspectRelationType aspectRelationType = aspectRelation.getRelationType();
+ final String opinionPointer = aspectRelation.getRef();
+ if (AspectRelationType.OPINION == aspectRelationType) {
+ opinionSentiments.add(toOpinionSentiment(
+ findSentimentOpinion(opinionPointer, documentSentimentList)));
+ }
+ });
+
+ minedOpinions.add(new MinedOpinion(
+ new AspectSentiment(sentenceAspect.getText(),
+ TextSentiment.fromString(sentenceAspect.getSentiment().toString()),
+ sentenceAspect.getOffset(), sentenceAspect.getLength(),
+ toSentimentConfidenceScores(sentenceAspect.getConfidenceScores())),
+ new IterableStream<>(opinionSentiments)));
+ });
+
+ return new IterableStream<>(minedOpinions);
+ }
+
+ /*
+ * Transform type AspectConfidenceScoreLabel to SentimentConfidenceScores.
+ */
+ private SentimentConfidenceScores toSentimentConfidenceScores(
+ AspectConfidenceScoreLabel aspectConfidenceScoreLabel) {
+ return new SentimentConfidenceScores(aspectConfidenceScoreLabel.getNegative(), NEUTRAL_SCORE_ZERO,
+ aspectConfidenceScoreLabel.getPositive());
+ }
+
+ /*
+ * Transform type SentenceOpinion to OpinionSentiment.
+ */
+ private OpinionSentiment toOpinionSentiment(SentenceOpinion sentenceOpinion) {
+ return new OpinionSentiment(sentenceOpinion.getText(),
+ TextSentiment.fromString(sentenceOpinion.getSentiment().toString()),
+ sentenceOpinion.getOffset(), sentenceOpinion.getLength(), sentenceOpinion.isNegated(),
+ toSentimentConfidenceScores(sentenceOpinion.getConfidenceScores()));
+ }
+
+ /*
+ * Parses the reference pointer to an index array that contains document, sentence, and opinion indexes.
+ */
+ int[] parseRefPointerToIndexArray(String opinionPointer) {
+ // The pattern always start with character '#', the opinion index will existing in specified sentence, which
+ // is under specified document.
+ // example: #/documents/0/sentences/0/opinions/0
+ final String patternRegex = "#/documents/(\\d+)/sentences/(\\d+)/opinions/(\\d+)";
+ final Pattern pattern = Pattern.compile(patternRegex);
+ final Matcher matcher = pattern.matcher(opinionPointer);
+ final boolean isMatched = matcher.find();
+
+ // The first index represents the document index, second one represents the sentence index,
+ // third ond represents the opinion index.
+ final int[] result = new int[3];
+
+ if (isMatched) {
+ String[] segments = opinionPointer.split("/");
+ result[0] = Integer.parseInt(segments[2]);
+ result[1] = Integer.parseInt(segments[4]);
+ result[2] = Integer.parseInt(segments[6]);
+ } else {
+ throw logger.logExceptionAsError(new IllegalStateException(
+ String.format("'%s' is not a valid opinion pointer.", opinionPointer)));
+ }
+
+ return result;
+ }
+
+ /*
+ * Find the specific sentence opinion in the document sentiment list by given the opinion reference pointer.
+ */
+ SentenceOpinion findSentimentOpinion(String opinionPointer, List documentSentiments) {
+ final int[] opinionIndexes = parseRefPointerToIndexArray(opinionPointer);
+ final int documentIndex = opinionIndexes[0];
+ final int sentenceIndex = opinionIndexes[1];
+ final int opinionIndex = opinionIndexes[2];
+ if (documentIndex >= documentSentiments.size()) {
+ throw logger.logExceptionAsError(new IllegalStateException(
+ String.format("Invalid document index '%s' in '%s'.", documentIndex, opinionPointer)));
+ }
+ final DocumentSentiment documentsentiment = documentSentiments.get(documentIndex);
+
+ final List sentenceSentiments =
+ documentsentiment.getSentences();
+ if (sentenceIndex >= sentenceSentiments.size()) {
+ throw logger.logExceptionAsError(new IllegalStateException(
+ String.format("Invalid sentence index '%s' in '%s'.", sentenceIndex, opinionPointer)));
+ }
+
+ final List opinions = sentenceSentiments.get(sentenceIndex).getOpinions();
+ if (opinionIndex >= opinions.size()) {
+ throw logger.logExceptionAsError(new IllegalStateException(
+ String.format("Invalid opinion index '%s' in '%s'.", opinionIndex, opinionPointer)));
+ }
+ return opinions.get(opinionIndex);
}
}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClient.java
index 4b409506aeb24..a41dc79c274ae 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClient.java
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClient.java
@@ -4,6 +4,7 @@
package com.azure.ai.textanalytics;
import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl;
+import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions;
import com.azure.ai.textanalytics.models.AnalyzeSentimentResult;
import com.azure.ai.textanalytics.models.CategorizedEntityCollection;
import com.azure.ai.textanalytics.models.DetectLanguageInput;
@@ -130,7 +131,7 @@ public String getDefaultLanguage() {
*
* @return A {@link Mono} containing the {@link DetectedLanguage detected language} of the document.
*
- * @throws NullPointerException if the document is {@code null}.
+ * @throws NullPointerException if the document is null.
* @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -157,7 +158,7 @@ public Mono detectLanguage(String document) {
*
* @return A {@link Mono} contains a {@link DetectedLanguage detected language} of the document.
*
- * @throws NullPointerException if the document is {@code null}.
+ * @throws NullPointerException if the document is null.
* @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -203,7 +204,7 @@ public Mono detectLanguage(String document, String countryHint
*
* @return A {@link Mono} contains a {@link DetectLanguageResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono detectLanguageBatch(
@@ -239,7 +240,7 @@ public Mono detectLanguageBatch(
*
* @return A {@link Mono} contains a {@link Response} which contains a {@link DetectLanguageResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> detectLanguageBatchWithResponse(
@@ -271,7 +272,7 @@ public Mono> detectLanguageBatchWithRes
*
* @return A {@link Mono} contains a {@link CategorizedEntityCollection recognized categorized entities collection}.
*
- * @throws NullPointerException if {@code document} is {@code null}.
+ * @throws NullPointerException if {@code document} is null.
* @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -299,7 +300,7 @@ public Mono recognizeEntities(String document) {
*
* @return A {@link Mono} contains a {@link CategorizedEntityCollection recognized categorized entities collection}.
*
- * @throws NullPointerException if {@code document} is {@code null}.
+ * @throws NullPointerException if {@code document} is null.
* @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -327,7 +328,7 @@ public Mono recognizeEntities(String document, Stri
*
* @return A {@link Mono} contains a {@link RecognizeEntitiesResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono recognizeEntitiesBatch(
@@ -362,7 +363,7 @@ public Mono recognizeEntitiesBatch(
*
* @return A {@link Mono} contains a {@link Response} which contains a {@link RecognizeEntitiesResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> recognizeEntitiesBatchWithResponse(
@@ -516,7 +517,7 @@ public Mono> recognizePiiEntities
*
* @return A {@link Mono} contains a {@link LinkedEntityCollection recognized linked entities collection}.
*
- * @throws NullPointerException if {@code document} is {@code null}.
+ * @throws NullPointerException if {@code document} is null.
* @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -541,7 +542,7 @@ public Mono recognizeLinkedEntities(String document) {
*
* @return A {@link Mono} contains a {@link LinkedEntityCollection recognized linked entities collection}.
*
- * @throws NullPointerException if {@code document} is {@code null}.
+ * @throws NullPointerException if {@code document} is null.
* @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -570,7 +571,7 @@ public Mono recognizeLinkedEntities(String document, Str
*
* @return A {@link Mono} contains a {@link RecognizeLinkedEntitiesResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono recognizeLinkedEntitiesBatch(
@@ -607,7 +608,7 @@ public Mono recognizeLinkedEntitiesBatc
* @return A {@link Mono} contains a {@link Response} which contains a
* {@link RecognizeLinkedEntitiesResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>
@@ -636,7 +637,7 @@ public Mono recognizeLinkedEntitiesBatc
*
* @return A {@link Mono} contains a {@link KeyPhrasesCollection}.
*
- * @throws NullPointerException if {@code document} is {@code null}.
+ * @throws NullPointerException if {@code document} is null.
* @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -662,7 +663,7 @@ public Mono extractKeyPhrases(String document) {
*
* @return A {@link Mono} contains a {@link KeyPhrasesCollection}
*
- * @throws NullPointerException if {@code document} is {@code null}.
+ * @throws NullPointerException if {@code document} is null.
* @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -691,7 +692,7 @@ public Mono extractKeyPhrases(String document, String lang
*
* @return A {@link Mono} contains a {@link ExtractKeyPhrasesResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono extractKeyPhrasesBatch(
@@ -726,7 +727,7 @@ public Mono extractKeyPhrasesBatch(
*
* @return A {@link Mono} contains a {@link Response} that contains a {@link ExtractKeyPhrasesResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> extractKeyPhrasesBatchWithResponse(
@@ -744,7 +745,8 @@ public Mono> extractKeyPhrasesBatchW
* {@link TextAnalyticsClientBuilder#defaultLanguage(String)}. If none is specified, service will use 'en' as
* the language.
*
- *
Analyze sentiment in a list of documents. Subscribes to the call asynchronously and prints out the
+ *
Code Sample
+ *
Analyze the sentiment in a document. Subscribes to the call asynchronously and prints out the
* sentiment details when a response is received.
*
* {@codesnippet com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#string}
@@ -755,7 +757,7 @@ public Mono> extractKeyPhrasesBatchW
*
* @return A {@link Mono} contains the {@link DocumentSentiment analyzed document sentiment} of the document.
*
- * @throws NullPointerException if {@code document} is {@code null}.
+ * @throws NullPointerException if {@code document} is null.
* @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -767,10 +769,11 @@ public Mono analyzeSentiment(String document) {
* Returns a sentiment prediction, as well as confidence scores for each sentiment label (Positive, Negative, and
* Neutral) for the document and each sentence within it.
*
- *
Analyze sentiment in a list of documents. Subscribes to the call asynchronously and prints out the
- * sentiment details when a response is received.
+ *
Code Sample
+ *
Analyze the sentiments in a document with a provided language representation. Subscribes to the call
+ * asynchronously and prints out the sentiment details when a response is received.
*
- * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#string-string}
+ * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#String-String}
*
* @param document The document to be analyzed.
* For text length limits, maximum batch size, and supported text encoding, see
@@ -780,14 +783,46 @@ public Mono analyzeSentiment(String document) {
*
* @return A {@link Mono} contains the {@link DocumentSentiment analyzed document sentiment} of the document.
*
- * @throws NullPointerException if {@code document} is {@code null}.
+ * @throws NullPointerException if {@code document} is null.
* @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono analyzeSentiment(String document, String language) {
+ return analyzeSentiment(document, language, null);
+ }
+
+ /**
+ * Returns a sentiment prediction, as well as confidence scores for each sentiment label (Positive, Negative, and
+ * Neutral) for the document and each sentence within it. If the {@code includeOpinionMining} of
+ * {@link AnalyzeSentimentOptions} set to true, the output will include the opinion mining results. It mines the
+ * opinions of a sentence and conducts more granular analysis around the aspects in the text
+ * (also known as aspect-based sentiment analysis).
+ *
+ *
Code Sample
+ *
Analyze the sentiment and mine the opinions for each sentence in a document with a provided language
+ * representation and {@link AnalyzeSentimentOptions} options. Subscribes to the call asynchronously and prints
+ * out the sentiment and mined opinions details when a response is received.
+ *
+ * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#String-String-AnalyzeSentimentOptions}
+ *
+ * @param document The document to be analyzed.
+ * For text length limits, maximum batch size, and supported text encoding, see
+ * data limits.
+ * @param language The 2 letter ISO 639-1 representation of language for the text. If not set, uses "en" for
+ * English as default.
+ * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when
+ * analyzing sentiments.
+ *
+ * @return A {@link Mono} contains the {@link DocumentSentiment analyzed document sentiment} of the document.
+ *
+ * @throws NullPointerException if {@code document} is null.
+ * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono analyzeSentiment(String document, String language, AnalyzeSentimentOptions options) {
try {
Objects.requireNonNull(document, "'document' cannot be null.");
- return analyzeSentimentBatch(Collections.singletonList(document), language, null)
+ return analyzeSentimentBatch(Collections.singletonList(document), language, options)
.map(sentimentResultCollection -> {
DocumentSentiment documentSentiment = null;
for (AnalyzeSentimentResult sentimentResult : sentimentResultCollection) {
@@ -824,11 +859,47 @@ public Mono analyzeSentiment(String document, String language
*
* @return A {@link Mono} contains a {@link AnalyzeSentimentResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
+ * @throws IllegalArgumentException if {@code documents} is empty.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono analyzeSentimentBatch(
Iterable documents, String language, TextAnalyticsRequestOptions options) {
+ return analyzeSentimentBatch(documents, language, new AnalyzeSentimentOptions()
+ .setIncludeStatistics(options == null ? false : options.isIncludeStatistics())
+ .setModelVersion(options == null ? null : options.getModelVersion()));
+ }
+
+ /**
+ * Returns a sentiment prediction, as well as confidence scores for each sentiment label (Positive, Negative, and
+ * Neutral) for the document and each sentence within it. If the {@code includeOpinionMining} of
+ * {@link AnalyzeSentimentOptions} set to true, the output will include the opinion mining results. It mines the
+ * opinions of a sentence and conducts more granular analysis around the aspects in the text
+ * (also known as aspect-based sentiment analysis).
+ *
+ *
Code Sample
+ *
Analyze the sentiments and mine the opinions for each sentence in a list of documents with a provided language
+ * representation and {@link AnalyzeSentimentOptions} options. Subscribes to the call asynchronously and prints out
+ * the sentiment and mined opinions details when a response is received.
+ *
+ * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-String-AnalyzeSentimentOptions}
+ *
+ * @param documents A list of documents to be analyzed.
+ * For text length limits, maximum batch size, and supported text encoding, see
+ * data limits.
+ * @param language The 2 letter ISO 639-1 representation of language for the document. If not set, uses "en" for
+ * English as default.
+ * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when
+ * analyzing sentiments.
+ *
+ * @return A {@link Mono} contains a {@link AnalyzeSentimentResultCollection}.
+ *
+ * @throws NullPointerException if {@code documents} is null.
+ * @throws IllegalArgumentException if {@code documents} is empty.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono analyzeSentimentBatch(Iterable documents,
+ String language, AnalyzeSentimentOptions options) {
try {
return analyzeSentimentBatchWithResponse(
mapByIndex(documents, (index, value) -> {
@@ -858,11 +929,45 @@ public Mono analyzeSentimentBatch(
*
* @return A {@link Mono} contains a {@link Response} that contains a {@link AnalyzeSentimentResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
+ * @throws IllegalArgumentException if {@code documents} is empty.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> analyzeSentimentBatchWithResponse(
Iterable documents, TextAnalyticsRequestOptions options) {
+ return analyzeSentimentAsyncClient.analyzeSentimentBatch(documents, new AnalyzeSentimentOptions()
+ .setIncludeStatistics(options == null ? false : options.isIncludeStatistics())
+ .setModelVersion(options == null ? null : options.getModelVersion()));
+ }
+
+ /**
+ * Returns a sentiment prediction, as well as confidence scores for each sentiment label (Positive, Negative, and
+ * Neutral) for the document and each sentence within it. If the {@code includeOpinionMining} of
+ * {@link AnalyzeSentimentOptions} set to true, the output will include the opinion mining results. It mines the
+ * opinions of a sentence and conducts more granular analysis around the aspects in the text
+ * (also known as aspect-based sentiment analysis).
+ *
+ *
Code Sample
+ *
Analyze sentiment and mine the opinions for each sentence in a list of
+ * {@link TextDocumentInput document} with provided {@link AnalyzeSentimentOptions} options. Subscribes to the call
+ * asynchronously and prints out the sentiment and mined opinions details when a response is received.
+ *
+ * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-AnalyzeSentimentOptions}
+ *
+ * @param documents A list of {@link TextDocumentInput documents} to be analyzed.
+ * For text length limits, maximum batch size, and supported text encoding, see
+ * data limits.
+ * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when
+ * analyzing sentiments.
+ *
+ * @return A {@link Mono} contains a {@link Response} that contains a {@link AnalyzeSentimentResultCollection}.
+ *
+ * @throws NullPointerException if {@code documents} is null.
+ * @throws IllegalArgumentException if {@code documents} is empty.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> analyzeSentimentBatchWithResponse(
+ Iterable documents, AnalyzeSentimentOptions options) {
return analyzeSentimentAsyncClient.analyzeSentimentBatch(documents, options);
}
}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClient.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClient.java
index 01508a1e2a3f1..360baf9aacaff 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClient.java
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClient.java
@@ -3,6 +3,7 @@
package com.azure.ai.textanalytics;
+import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions;
import com.azure.ai.textanalytics.models.CategorizedEntity;
import com.azure.ai.textanalytics.models.CategorizedEntityCollection;
import com.azure.ai.textanalytics.models.DetectLanguageInput;
@@ -94,7 +95,7 @@ public String getDefaultLanguage() {
*
* @return The {@link DetectedLanguage detected language} of the document.
*
- * @throws NullPointerException if {@code document} is {@code null}.
+ * @throws NullPointerException if {@code document} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DetectedLanguage detectLanguage(String document) {
@@ -118,7 +119,7 @@ public DetectedLanguage detectLanguage(String document) {
*
* @return The {@link DetectedLanguage detected language} of the document.
*
- * @throws NullPointerException if {@code document} is {@code null}.
+ * @throws NullPointerException if {@code document} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DetectedLanguage detectLanguage(String document, String countryHint) {
@@ -143,7 +144,7 @@ public DetectedLanguage detectLanguage(String document, String countryHint) {
*
* @return A {@link DetectLanguageResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
* @throws IllegalArgumentException if {@code documents} is empty.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -170,7 +171,7 @@ public DetectLanguageResultCollection detectLanguageBatch(
*
* @return A {@link Response} that contains a {@link DetectLanguageResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
* @throws IllegalArgumentException if {@code documents} is empty.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -201,7 +202,7 @@ public Response detectLanguageBatchWithResponse(
* @return A {@link CategorizedEntityCollection} contains a list of
* {@link CategorizedEntity recognized categorized entities} and warnings.
*
- * @throws NullPointerException if {@code document} is {@code null}.
+ * @throws NullPointerException if {@code document} is null.
* @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -227,7 +228,7 @@ public CategorizedEntityCollection recognizeEntities(String document) {
* @return The {@link CategorizedEntityCollection} contains a list of
* {@link CategorizedEntity recognized categorized entities} and warnings.
*
- * @throws NullPointerException if {@code document} is {@code null}.
+ * @throws NullPointerException if {@code document} is null.
* @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -253,7 +254,7 @@ public CategorizedEntityCollection recognizeEntities(String document, String lan
*
* @return A {@link RecognizeEntitiesResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
* @throws IllegalArgumentException if {@code documents} is empty.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -281,7 +282,7 @@ public RecognizeEntitiesResultCollection recognizeEntitiesBatch(
*
* @return A {@link Response} that contains a {@link RecognizeEntitiesResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
* @throws IllegalArgumentException if {@code documents} is empty.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -423,7 +424,7 @@ public Response recognizePiiEntitiesBatchW
*
* @return A {@link LinkedEntityCollection} contains a list of {@link LinkedEntity recognized linked entities}.
*
- * @throws NullPointerException if {@code document} is {@code null}.
+ * @throws NullPointerException if {@code document} is null.
* @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -449,7 +450,7 @@ public LinkedEntityCollection recognizeLinkedEntities(String document) {
*
* @return A {@link LinkedEntityCollection} contains a list of {@link LinkedEntity recognized linked entities}.
*
- * @throws NullPointerException if {@code document} is {@code null}.
+ * @throws NullPointerException if {@code document} is null.
* @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -479,7 +480,7 @@ public LinkedEntityCollection recognizeLinkedEntities(String document, String la
*
* @return A {@link RecognizeLinkedEntitiesResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
* @throws IllegalArgumentException if {@code documents} is empty.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -509,7 +510,7 @@ public RecognizeLinkedEntitiesResultCollection recognizeLinkedEntitiesBatch(
*
* @return A {@link Response} that contains a {@link RecognizeLinkedEntitiesResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
* @throws IllegalArgumentException if {@code documents} is empty.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -539,7 +540,7 @@ public RecognizeLinkedEntitiesResultCollection recognizeLinkedEntitiesBatch(
*
* @return A {@link KeyPhrasesCollection} contains a list of extracted key phrases.
*
- * @throws NullPointerException if {@code document} is {@code null}.
+ * @throws NullPointerException if {@code document} is null.
* @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -563,7 +564,7 @@ public KeyPhrasesCollection extractKeyPhrases(String document) {
*
* @return A {@link KeyPhrasesCollection} contains a list of extracted key phrases.
*
- * @throws NullPointerException if {@code document} is {@code null}.
+ * @throws NullPointerException if {@code document} is null.
* @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -592,7 +593,7 @@ public KeyPhrasesCollection extractKeyPhrases(String document, String language)
*
* @return A {@link ExtractKeyPhrasesResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
* @throws IllegalArgumentException if {@code documents} is empty.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -621,7 +622,7 @@ public ExtractKeyPhrasesResultCollection extractKeyPhrasesBatch(
*
* @return A {@link Response} that contains a {@link ExtractKeyPhrasesResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
* @throws IllegalArgumentException if {@code documents} is empty.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -635,7 +636,7 @@ public Response extractKeyPhrasesBatchWithRes
// Sentiment
/**
* Returns a sentiment prediction, as well as confidence scores for each sentiment label
- * (Positive, Negative, and Neutral) for the document and each sentence within i
+ * (Positive, Negative, and Neutral) for the document and each sentence within it.
*
* This method will use the default language that can be set by using method
* {@link TextAnalyticsClientBuilder#defaultLanguage(String)}. If none is specified, service will use 'en' as
@@ -643,6 +644,7 @@ public Response extractKeyPhrasesBatchWithRes
*
*
Code Sample
*
Analyze the sentiments of documents
+ *
* {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentiment#String}
*
* @param document The document to be analyzed.
@@ -651,7 +653,7 @@ public Response extractKeyPhrasesBatchWithRes
*
* @return A {@link DocumentSentiment analyzed document sentiment} of the document.
*
- * @throws NullPointerException if {@code document} is {@code null}.
+ * @throws NullPointerException if {@code document} is null.
* @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
@@ -661,10 +663,11 @@ public DocumentSentiment analyzeSentiment(String document) {
/**
* Returns a sentiment prediction, as well as confidence scores for each sentiment label
- * (Positive, Negative, and Neutral) for the document and each sentence within i
+ * (Positive, Negative, and Neutral) for the document and each sentence within it.
*
*
Code Sample
*
Analyze the sentiments in a document with a provided language representation.
+ *
* {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentiment#String-String}
*
* @param document The document to be analyzed.
@@ -675,15 +678,45 @@ public DocumentSentiment analyzeSentiment(String document) {
*
* @return A {@link DocumentSentiment analyzed document sentiment} of the document.
*
- * @throws NullPointerException if {@code document} is {@code null}.
+ * @throws NullPointerException if {@code document} is null.
* @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DocumentSentiment analyzeSentiment(String document, String language) {
- Objects.requireNonNull(document, "'document' cannot be null.");
return client.analyzeSentiment(document, language).block();
}
+ /**
+ * Returns a sentiment prediction, as well as confidence scores for each sentiment label (Positive, Negative, and
+ * Neutral) for the document and each sentence within it. If the {@code includeOpinionMining} of
+ * {@link AnalyzeSentimentOptions} set to true, the output will include the opinion mining results. It mines the
+ * opinions of a sentence and conducts more granular analysis around the aspects in the text
+ * (also known as aspect-based sentiment analysis).
+ *
+ *
Code Sample
+ *
Analyze the sentiment and mine the opinions for each sentence in a document with a provided language
+ * representation and {@link AnalyzeSentimentOptions} options.
+ *
+ * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentiment#String-String-AnalyzeSentimentOptions}
+ *
+ * @param document The document to be analyzed.
+ * For text length limits, maximum batch size, and supported text encoding, see
+ * data limits.
+ * @param language The 2 letter ISO 639-1 representation of language for the document. If not set, uses "en" for
+ * English as default.
+ * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when
+ * analyzing sentiments.
+ *
+ * @return A {@link DocumentSentiment analyzed document sentiment} of the document.
+ *
+ * @throws NullPointerException if {@code document} is null.
+ * @throws TextAnalyticsException if the response returned with an {@link TextAnalyticsError error}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public DocumentSentiment analyzeSentiment(String document, String language, AnalyzeSentimentOptions options) {
+ return client.analyzeSentiment(document, language, options).block();
+ }
+
/**
* Returns a sentiment prediction, as well as confidence scores for each sentiment label
* (Positive, Negative, and Neutral) for the document and each sentence within it.
@@ -702,13 +735,44 @@ public DocumentSentiment analyzeSentiment(String document, String language) {
*
* @return A {@link AnalyzeSentimentResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
* @throws IllegalArgumentException if {@code documents} is empty.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public AnalyzeSentimentResultCollection analyzeSentimentBatch(
Iterable documents, String language, TextAnalyticsRequestOptions options) {
- inputDocumentsValidation(documents);
+ return client.analyzeSentimentBatch(documents, language, options).block();
+ }
+
+ /**
+ * Returns a sentiment prediction, as well as confidence scores for each sentiment label (Positive, Negative, and
+ * Neutral) for the document and each sentence within it. If the {@code includeOpinionMining} of
+ * {@link AnalyzeSentimentOptions} set to true, the output will include the opinion mining results. It mines the
+ * opinions of a sentence and conducts more granular analysis around the aspects in the text
+ * (also known as aspect-based sentiment analysis).
+ *
+ *
Code Sample
+ *
Analyze the sentiments and mine the opinions for each sentence in a list of documents with a provided language
+ * representation and {@link AnalyzeSentimentOptions} options.
+ *
+ * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-String-AnalyzeSentimentOptions}
+ *
+ * @param documents A list of documents to be analyzed.
+ * For text length limits, maximum batch size, and supported text encoding, see
+ * data limits.
+ * @param language The 2 letter ISO 639-1 representation of language for the documents. If not set, uses "en" for
+ * English as default.
+ * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when
+ * analyzing sentiments.
+ *
+ * @return A {@link AnalyzeSentimentResultCollection}.
+ *
+ * @throws NullPointerException if {@code documents} is null.
+ * @throws IllegalArgumentException if {@code documents} is empty.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public AnalyzeSentimentResultCollection analyzeSentimentBatch(Iterable documents,
+ String language, AnalyzeSentimentOptions options) {
return client.analyzeSentimentBatch(documents, language, options).block();
}
@@ -717,8 +781,8 @@ public AnalyzeSentimentResultCollection analyzeSentimentBatch(
* (Positive, Negative, and Neutral) for the document and each sentence within it.
*
*
Code Sample
- *
Analyze the sentiments with http response in a list of {@link TextDocumentInput documents} with request
- * options.
+ *
Analyze sentiment in a list of {@link TextDocumentInput document} with provided request options.
+ *
* {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-TextAnalyticsRequestOptions-Context}
*
* @param documents A list of {@link TextDocumentInput documents} to be analyzed.
@@ -730,13 +794,46 @@ public AnalyzeSentimentResultCollection analyzeSentimentBatch(
*
* @return A {@link Response} that contains a {@link AnalyzeSentimentResultCollection}.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
* @throws IllegalArgumentException if {@code documents} is empty.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response analyzeSentimentBatchWithResponse(
Iterable documents, TextAnalyticsRequestOptions options, Context context) {
- inputDocumentsValidation(documents);
+ return client.analyzeSentimentAsyncClient.analyzeSentimentBatchWithContext(documents,
+ new AnalyzeSentimentOptions()
+ .setIncludeStatistics(options == null ? false : options.isIncludeStatistics())
+ .setModelVersion(options == null ? null : options.getModelVersion()), context).block();
+ }
+
+ /**
+ * Returns a sentiment prediction, as well as confidence scores for each sentiment label (Positive, Negative, and
+ * Neutral) for the document and each sentence within it. If the {@code includeOpinionMining} of
+ * {@link AnalyzeSentimentOptions} set to true, the output will include the opinion mining results. It mines the
+ * opinions of a sentence and conducts more granular analysis around the aspects in the text
+ * (also known as aspect-based sentiment analysis).
+ *
+ *
Code Sample
+ *
Analyze sentiment and mine the opinions for each sentence in a list of
+ * {@link TextDocumentInput document} with provided {@link AnalyzeSentimentOptions} options.
+ *
+ * {@codesnippet com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-AnalyzeSentimentOptions-Context}
+ *
+ * @param documents A list of {@link TextDocumentInput documents} to be analyzed.
+ * For text length limits, maximum batch size, and supported text encoding, see
+ * data limits.
+ * @param options The additional configurable {@link AnalyzeSentimentOptions options} that may be passed when
+ * analyzing sentiments.
+ * @param context Additional context that is passed through the Http pipeline during the service call.
+ *
+ * @return A {@link Response} that contains a {@link AnalyzeSentimentResultCollection}.
+ *
+ * @throws NullPointerException if {@code documents} is null.
+ * @throws IllegalArgumentException if {@code documents} is empty.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response analyzeSentimentBatchWithResponse(
+ Iterable documents, AnalyzeSentimentOptions options, Context context) {
return client.analyzeSentimentAsyncClient.analyzeSentimentBatchWithContext(documents, options, context).block();
}
}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClientBuilder.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClientBuilder.java
index c1caf08b07855..7b45936e81500 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClientBuilder.java
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/TextAnalyticsClientBuilder.java
@@ -259,7 +259,7 @@ public TextAnalyticsClientBuilder endpoint(String endpoint) {
*
* @param keyCredential {@link AzureKeyCredential} API key credential
* @return The updated {@link TextAnalyticsClientBuilder} object.
- * @throws NullPointerException If {@code keyCredential} is {@code null}
+ * @throws NullPointerException If {@code keyCredential} is null
*/
public TextAnalyticsClientBuilder credential(AzureKeyCredential keyCredential) {
this.credential = Objects.requireNonNull(keyCredential, "'keyCredential' cannot be null.");
@@ -271,7 +271,7 @@ public TextAnalyticsClientBuilder credential(AzureKeyCredential keyCredential) {
*
* @param tokenCredential {@link TokenCredential} used to authenticate HTTP requests.
* @return The updated {@link TextAnalyticsClientBuilder} object.
- * @throws NullPointerException If {@code tokenCredential} is {@code null}.
+ * @throws NullPointerException If {@code tokenCredential} is null.
*/
public TextAnalyticsClientBuilder credential(TokenCredential tokenCredential) {
Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null.");
@@ -297,7 +297,7 @@ public TextAnalyticsClientBuilder httpLogOptions(HttpLogOptions logOptions) {
*
* @param policy The retry policy for service requests.
* @return The updated {@link TextAnalyticsClientBuilder} object.
- * @throws NullPointerException If {@code policy} is {@code null}.
+ * @throws NullPointerException If {@code policy} is null.
*/
public TextAnalyticsClientBuilder addPolicy(HttpPipelinePolicy policy) {
policies.add(Objects.requireNonNull(policy, "'policy' cannot be null."));
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/Utility.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/Utility.java
index 9555c37106f6e..76a31499534d9 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/Utility.java
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/implementation/Utility.java
@@ -46,7 +46,7 @@ private Utility() {
*
* @param documents A list of documents.
*
- * @throws NullPointerException if {@code documents} is {@code null}.
+ * @throws NullPointerException if {@code documents} is null.
* @throws IllegalArgumentException if {@code documents} is empty.
*/
public static void inputDocumentsValidation(Iterable> documents) {
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AnalyzeSentimentOptions.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AnalyzeSentimentOptions.java
new file mode 100644
index 0000000000000..5c38135d5a1cb
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AnalyzeSentimentOptions.java
@@ -0,0 +1,73 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.textanalytics.models;
+
+import com.azure.core.annotation.Fluent;
+
+/**
+ * The {@link AnalyzeSentimentOptions} model.
+ */
+@Fluent
+public final class AnalyzeSentimentOptions extends TextAnalyticsRequestOptions {
+
+ /*
+ * The boolean indicator to include opinion mining data in the returned result. If this
+ * flag is specified, you'll get a {@code minedOpinions} property on SentenceSentiment. It is provided by service
+ * v3.1-preview.1 and later.
+ */
+ private boolean includeOpinionMining;
+
+ /**
+ * Set the model version. This value indicates which model will be used for scoring, e.g. "latest", "2019-10-01".
+ * If a model-version is not specified, the API will default to the latest, non-preview version.
+ *
+ * @param modelVersion The model version.
+ *
+ * @return The {@link AnalyzeSentimentOptions} object itself.
+ */
+ @Override
+ public AnalyzeSentimentOptions setModelVersion(String modelVersion) {
+ super.setModelVersion(modelVersion);
+ return this;
+ }
+
+ /**
+ * Set the value of {@code includeStatistics}.
+ *
+ * @param includeStatistics If a boolean value was specified in the request this field will contain
+ * information about the document payload.
+ *
+ * @return the {@link AnalyzeSentimentOptions} object itself.
+ */
+ @Override
+ public AnalyzeSentimentOptions setIncludeStatistics(boolean includeStatistics) {
+ super.setIncludeStatistics(includeStatistics);
+ return this;
+ }
+
+ /**
+ * Get the value of {@code includeOpinionMining}. The boolean indicator to include opinion mining data in the
+ * returned result. If this flag is specified, you'll get a {@code minedOpinions} property on SentenceSentiment.
+ * It is provided by service v3.1-preview.1 and later.
+ *
+ * @return the value of {@code includeOpinionMining}.
+ */
+ public boolean isIncludeOpinionMining() {
+ return includeOpinionMining;
+ }
+
+ /**
+ * Set the value of {@code includeOpinionMining}. The boolean indicator to include opinion mining data in the
+ * returned result. If this flag is specified, you'll get a {@code minedOpinions} property on SentenceSentiment.
+ * It is provided by service v3.1-preview.1 and later.
+ *
+ * @param includeOpinionMining The boolean indicator to include opinion mining data in the returned result.
+ *
+ * @return the AnalyzeSentimentOptions object itself.
+ */
+ public AnalyzeSentimentOptions setIncludeOpinionMining(boolean includeOpinionMining) {
+ this.includeOpinionMining = includeOpinionMining;
+ return this;
+ }
+}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AspectSentiment.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AspectSentiment.java
new file mode 100644
index 0000000000000..706e6d62e624d
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/AspectSentiment.java
@@ -0,0 +1,86 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.textanalytics.models;
+
+import com.azure.core.annotation.Immutable;
+
+/**
+ * The {@link AspectSentiment} model.
+ */
+@Immutable
+public final class AspectSentiment {
+ private final String text;
+ private final TextSentiment sentiment;
+ private final SentimentConfidenceScores confidenceScores;
+ private final int length;
+ private final int offset;
+
+ /**
+ * Create an {@link AspectSentiment} model that describes aspect.
+ *
+ * @param text The aspect text property.
+ * @param sentiment The text sentiment label: POSITIVE, NEGATIVE, MIXED. {@link TextSentiment} has
+ * NEUTRAL sentiment type additionally, but aspect sentiment can only be POSITIVE, NEGATIVE, or MIXED.
+ * @param offset The aspect text offset from the start of document.
+ * @param length The length of aspect text.
+ * @param confidenceScores The {@link SentimentConfidenceScores}.
+ */
+ public AspectSentiment(String text, TextSentiment sentiment,
+ int offset, int length, SentimentConfidenceScores confidenceScores) {
+ this.text = text;
+ this.sentiment = sentiment;
+ this.confidenceScores = confidenceScores;
+ this.length = length;
+ this.offset = offset;
+ }
+
+ /**
+ * Get the aspect text property.
+ *
+ * @return The text value.
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * Get the aspect text sentiment label: POSITIVE, NEGATIVE, MIXED. {@link TextSentiment} has
+ * NEUTRAL sentiment type additionally, but aspect sentiment can only be POSITIVE, NEGATIVE, or MIXED.
+ *
+ * @return The sentiment value.
+ */
+ public TextSentiment getSentiment() {
+ return sentiment;
+ }
+
+
+ /**
+ * Get the aspect text offset from the start of document.
+ *
+ * @return The aspect text offset from the start of document.
+ */
+ public int getOffset() {
+ return offset;
+ }
+
+ /**
+ * Get the length of aspect text.
+ *
+ * @return The length of aspect text.
+ */
+ public int getLength() {
+ return length;
+ }
+
+ /**
+ * Get the confidence score of the sentiment label. All score values sum up to 1, the higher the score, the
+ * higher the confidence in the sentiment. AspectSentiment only has positive or negative confidence score value
+ * because there is no neutral sentiment label in the AspectSentiment.
+ *
+ * @return The {@link SentimentConfidenceScores}.
+ */
+ public SentimentConfidenceScores getConfidenceScores() {
+ return confidenceScores;
+ }
+}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/MinedOpinion.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/MinedOpinion.java
new file mode 100644
index 0000000000000..ce300ff9d0624
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/MinedOpinion.java
@@ -0,0 +1,45 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.textanalytics.models;
+
+import com.azure.core.util.IterableStream;
+
+/**
+ * The {@link MinedOpinion} model.
+ */
+public final class MinedOpinion {
+ private final AspectSentiment aspect;
+ private final IterableStream opinions;
+
+ /**
+ * Create an {@link MinedOpinion} model that describes the mined opinions.
+ *
+ * @param aspect The aspect of a product/service that the opinions is about.
+ * @param opinions The opinions of the aspect text.
+ */
+ public MinedOpinion(AspectSentiment aspect, IterableStream opinions) {
+ this.aspect = aspect;
+ this.opinions = opinions;
+ }
+
+ /**
+ * Get the aspect in text, such as the attributes of products or services. For example, if a customer leaves
+ * feedback about a hotel such as "the room was great, but the staff was unfriendly", opinion mining will locate
+ * aspects in the text. The "room" and "staff" are two aspects recognized.
+ *
+ * @return The aspect in text.
+ */
+ public AspectSentiment getAspect() {
+ return this.aspect;
+ }
+
+ /**
+ * Get the opinions of aspect text.
+ *
+ * @return The opinions of aspect text.
+ */
+ public IterableStream getOpinions() {
+ return opinions;
+ }
+}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/OpinionSentiment.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/OpinionSentiment.java
new file mode 100644
index 0000000000000..3530c72f58f8d
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/OpinionSentiment.java
@@ -0,0 +1,97 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.textanalytics.models;
+
+import com.azure.core.annotation.Immutable;
+
+/**
+ * The {@link OpinionSentiment} model.
+ */
+@Immutable
+public final class OpinionSentiment {
+ private final String text;
+ private final TextSentiment sentiment;
+ private final SentimentConfidenceScores confidenceScores;
+ private final boolean isNegated;
+ private final int length;
+ private final int offset;
+
+ /**
+ * Create an {@link OpinionSentiment} model that describes opinion sentiment.
+ *
+ * @param text The opinion text property.
+ * @param sentiment The text sentiment label: POSITIVE, NEGATIVE, MIXED. {@link TextSentiment} has
+ * {@code neutral} sentiment type additionally, but opinion sentiment can only be positive, negative, or mixed.
+ * @param offset The offset of opinion text.
+ * @param length The length of opinion text.
+ * @param isNegated The boolean indicator to show if the opinion text negated or not.
+ * @param confidenceScores The {@link SentimentConfidenceScores}.
+ */
+ public OpinionSentiment(String text, TextSentiment sentiment, int offset, int length,
+ boolean isNegated, SentimentConfidenceScores confidenceScores) {
+ this.text = text;
+ this.sentiment = sentiment;
+ this.offset = offset;
+ this.length = length;
+ this.isNegated = isNegated;
+ this.confidenceScores = confidenceScores;
+ }
+
+ /**
+ * Get the opinion text property.
+ *
+ * @return The text value.
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * Get the opinion text sentiment label: POSITIVE, NEGATIVE, MIXED. {@link TextSentiment} has
+ * {@code neutral} sentiment type additionally, but aspect sentiment can only be positive, negative, or mixed.
+ *
+ * @return The sentiment value.
+ */
+ public TextSentiment getSentiment() {
+ return sentiment;
+ }
+
+ /**
+ * Get the offset of opinion text.
+ *
+ * @return The offset of opinion text.
+ */
+ public int getOffset() {
+ return offset;
+ }
+
+ /**
+ * Get the length of opinion text.
+ *
+ * @return The length of opinion text.
+ */
+ public int getLength() {
+ return length;
+ }
+
+ /**
+ * Get the boolean indicator to show if the text is negative.
+ *
+ * @return The boolean indicator to show if the text is negative.
+ */
+ public boolean isNegated() {
+ return isNegated;
+ }
+
+ /**
+ * Get the confidence score of the sentiment label. All score values sum up to 1, the higher the score, the
+ * higher the confidence in the sentiment. OpinionSentiment only has positive or negative confidence score value
+ * because there is no neutral sentiment label in the OpinionSentiment.
+ *
+ * @return The {@link SentimentConfidenceScores}.
+ */
+ public SentimentConfidenceScores getConfidenceScores() {
+ return confidenceScores;
+ }
+}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/SentenceSentiment.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/SentenceSentiment.java
index 636739209fe96..67c550c41d5c7 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/SentenceSentiment.java
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/SentenceSentiment.java
@@ -4,6 +4,7 @@
package com.azure.ai.textanalytics.models;
import com.azure.core.annotation.Immutable;
+import com.azure.core.util.IterableStream;
/**
* The {@link SentenceSentiment} model that contains a sentiment label of a sentence, confidence score of the
@@ -14,11 +15,11 @@ public final class SentenceSentiment {
private final String text;
private final SentimentConfidenceScores confidenceScores;
private final TextSentiment sentiment;
+ private final IterableStream minedOpinions;
/**
* Creates a {@link SentenceSentiment} model that describes the sentiment analysis of sentence.
- *
- * @param text The sentence text
+ * @param text The sentence text.
* @param sentiment The sentiment label of the sentence.
* @param confidenceScores The sentiment confidence score (Softmax score) between 0 and 1, for each sentiment label.
* Higher values signify higher confidence.
@@ -26,13 +27,31 @@ public final class SentenceSentiment {
public SentenceSentiment(String text, TextSentiment sentiment, SentimentConfidenceScores confidenceScores) {
this.text = text;
this.sentiment = sentiment;
+ this.minedOpinions = null;
+ this.confidenceScores = confidenceScores;
+ }
+
+ /**
+ * Creates a {@link SentenceSentiment} model that describes the sentiment analysis of sentence.
+ * @param text The sentence text.
+ * @param sentiment The sentiment label of the sentence.
+ * @param minedOpinions The mined opinions of the sentence sentiment. This is only returned if you pass the
+ * opinion mining parameter to the analyze sentiment APIs.
+ * @param confidenceScores The sentiment confidence score (Softmax score) between 0 and 1, for each sentiment label.
+ * Higher values signify higher confidence.
+ */
+ public SentenceSentiment(String text, TextSentiment sentiment, IterableStream minedOpinions,
+ SentimentConfidenceScores confidenceScores) {
+ this.text = text;
+ this.sentiment = sentiment;
+ this.minedOpinions = minedOpinions;
this.confidenceScores = confidenceScores;
}
/**
* Get the sentence text property.
*
- * @return the text value.
+ * @return the text property value.
*/
public String getText() {
return this.text;
@@ -48,8 +67,18 @@ public TextSentiment getSentiment() {
}
/**
- * Get the confidence score of the sentiment label. All score values sum up to 1, higher the score value means
- * higher confidence the sentiment label represents.
+ * Get the mined opinions of sentence sentiment.
+ * This is only returned if you pass the opinion mining parameter to the analyze sentiment APIs.
+ *
+ * @return The mined opinions of sentence sentiment.
+ */
+ public IterableStream getMinedOpinions() {
+ return minedOpinions;
+ }
+
+ /**
+ * Get the confidence score of the sentiment label. All score values sum up to 1, the higher the score, the
+ * higher the confidence in the sentiment.
*
* @return The {@link SentimentConfidenceScores}.
*/
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsRequestOptions.java b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsRequestOptions.java
index b0c96cd9acc67..d566057cc04a2 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsRequestOptions.java
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics/models/TextAnalyticsRequestOptions.java
@@ -9,7 +9,7 @@
* The {@link TextAnalyticsRequestOptions} model.
*/
@Fluent
-public final class TextAnalyticsRequestOptions {
+public class TextAnalyticsRequestOptions {
private String modelVersion;
private boolean includeStatistics;
@@ -27,6 +27,7 @@ public String getModelVersion() {
* If a model-version is not specified, the API will default to the latest, non-preview version.
*
* @param modelVersion The model version.
+ *
* @return The {@link TextAnalyticsRequestOptions} object itself.
*/
public TextAnalyticsRequestOptions setModelVersion(String modelVersion) {
@@ -44,10 +45,12 @@ public boolean isIncludeStatistics() {
}
/**
- * Set the value of {@code includeStatistics}.
+ * Set the value of {@code includeStatistics}. If set to true, indicates that the service
+ * should return document and document batch statistics with the results of the operation.
*
* @param includeStatistics If a boolean value was specified in the request this field will contain
* information about the document payload.
+ *
* @return the {@link TextAnalyticsRequestOptions} object itself.
*/
public TextAnalyticsRequestOptions setIncludeStatistics(boolean includeStatistics) {
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentWithOpinionMining.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentWithOpinionMining.java
new file mode 100644
index 0000000000000..702908b70abcd
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentWithOpinionMining.java
@@ -0,0 +1,56 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.textanalytics;
+
+import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions;
+import com.azure.ai.textanalytics.models.AspectSentiment;
+import com.azure.ai.textanalytics.models.DocumentSentiment;
+import com.azure.ai.textanalytics.models.OpinionSentiment;
+import com.azure.ai.textanalytics.models.SentimentConfidenceScores;
+import com.azure.core.credential.AzureKeyCredential;
+
+/**
+ * Sample demonstrates how to synchronously analyze the sentiment of document with opinion mining.
+ */
+public class AnalyzeSentimentWithOpinionMining {
+ /**
+ * Main method to invoke this demo about how to analyze the sentiment of document.
+ *
+ * @param args Unused arguments to the program.
+ */
+ public static void main(String[] args) {
+ // Instantiate a client that will be used to call the service.
+ TextAnalyticsClient client = new TextAnalyticsClientBuilder()
+ .credential(new AzureKeyCredential("{key}"))
+ .endpoint("{endpoint}")
+ .buildClient();
+
+ // The text that needs be analyzed.
+ String document = "Bad atmosphere. Not close to plenty of restaurants, hotels, and transit! Staff are not friendly and helpful.";
+
+ System.out.printf("Text = %s%n", document);
+
+ AnalyzeSentimentOptions options = new AnalyzeSentimentOptions().setIncludeOpinionMining(true);
+ final DocumentSentiment documentSentiment = client.analyzeSentiment(document, "en", options);
+ SentimentConfidenceScores scores = documentSentiment.getConfidenceScores();
+ System.out.printf(
+ "Recognized document sentiment: %s, positive score: %f, neutral score: %f, negative score: %f.%n",
+ documentSentiment.getSentiment(), scores.getPositive(), scores.getNeutral(), scores.getNegative());
+
+ documentSentiment.getSentences().forEach(sentenceSentiment -> {
+ SentimentConfidenceScores sentenceScores = sentenceSentiment.getConfidenceScores();
+ System.out.printf("\tSentence sentiment: %s, positive score: %f, neutral score: %f, negative score: %f.%n",
+ sentenceSentiment.getSentiment(), sentenceScores.getPositive(), sentenceScores.getNeutral(), sentenceScores.getNegative());
+ sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> {
+ AspectSentiment aspectSentiment = minedOpinions.getAspect();
+ System.out.printf("\t\tAspect sentiment: %s, aspect text: %s%n", aspectSentiment.getSentiment(),
+ aspectSentiment.getText());
+ for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) {
+ System.out.printf("\t\t\t'%s' opinion sentiment because of \"%s\". Is the opinion negated: %s.%n",
+ opinionSentiment.getSentiment(), opinionSentiment.getText(), opinionSentiment.isNegated());
+ }
+ });
+ });
+ }
+}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentWithOpinionMiningAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentWithOpinionMiningAsync.java
new file mode 100644
index 0000000000000..83e7e682aaa12
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/AnalyzeSentimentWithOpinionMiningAsync.java
@@ -0,0 +1,68 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.textanalytics;
+
+import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions;
+import com.azure.ai.textanalytics.models.AspectSentiment;
+import com.azure.ai.textanalytics.models.OpinionSentiment;
+import com.azure.ai.textanalytics.models.SentimentConfidenceScores;
+import com.azure.core.credential.AzureKeyCredential;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Sample demonstrates how to asynchronously analyze the sentiment of document with opinion mining.
+ */
+public class AnalyzeSentimentWithOpinionMiningAsync {
+ /**
+ * Main method to invoke this demo about how to analyze the sentiment of document.
+ *
+ * @param args Unused arguments to the program.
+ */
+ public static void main(String[] args) {
+ // Instantiate a client that will be used to call the service.
+ TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder()
+ .credential(new AzureKeyCredential("{key}"))
+ .endpoint("{endpoint}")
+ .buildAsyncClient();
+
+ // The document that needs be analyzed.
+ String document = "Bad atmosphere. Not close to plenty of restaurants, hotels, and transit! Staff are not friendly and helpful.";
+
+ AnalyzeSentimentOptions options = new AnalyzeSentimentOptions().setIncludeOpinionMining(true);
+ client.analyzeSentiment(document, "en", options).subscribe(
+ documentSentiment -> {
+ SentimentConfidenceScores scores = documentSentiment.getConfidenceScores();
+ System.out.printf(
+ "Recognized document sentiment: %s, positive score: %f, neutral score: %f, negative score: %f.%n",
+ documentSentiment.getSentiment(), scores.getPositive(), scores.getNeutral(), scores.getNegative());
+
+ documentSentiment.getSentences().forEach(sentenceSentiment -> {
+ SentimentConfidenceScores sentenceScores = sentenceSentiment.getConfidenceScores();
+ System.out.printf("\tSentence sentiment: %s, positive score: %f, neutral score: %f, negative score: %f.%n",
+ sentenceSentiment.getSentiment(), sentenceScores.getPositive(), sentenceScores.getNeutral(), sentenceScores.getNegative());
+
+ sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> {
+ AspectSentiment aspectSentiment = minedOpinions.getAspect();
+ System.out.printf("\t\tAspect sentiment: %s, aspect text: %s%n", aspectSentiment.getSentiment(),
+ aspectSentiment.getText());
+ for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) {
+ System.out.printf("\t\t\t'%s' opinion sentiment because of \"%s\". Is the opinion negated: %s.%n",
+ opinionSentiment.getSentiment(), opinionSentiment.getText(), opinionSentiment.isNegated());
+ }
+ });
+ });
+ },
+ error -> System.err.println("There was an error analyzing sentiment of the text." + error),
+ () -> System.out.println("Sentiment analyzed."));
+
+ // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep
+ // the thread so the program does not end before the send operation is complete. Using .block() instead of
+ // .subscribe() will turn this into a synchronous call.
+ try {
+ TimeUnit.SECONDS.sleep(5);
+ } catch (InterruptedException ignored) {
+ }
+ }
+}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientJavaDocCodeSnippets.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientJavaDocCodeSnippets.java
index caf7f39605027..26f5faa0fa561 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientJavaDocCodeSnippets.java
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientJavaDocCodeSnippets.java
@@ -3,20 +3,23 @@
package com.azure.ai.textanalytics;
-import com.azure.ai.textanalytics.util.AnalyzeSentimentResultCollection;
+import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions;
+import com.azure.ai.textanalytics.models.AspectSentiment;
import com.azure.ai.textanalytics.models.DetectLanguageInput;
import com.azure.ai.textanalytics.models.DetectLanguageResult;
-import com.azure.ai.textanalytics.util.DetectLanguageResultCollection;
import com.azure.ai.textanalytics.models.DetectedLanguage;
import com.azure.ai.textanalytics.models.DocumentSentiment;
import com.azure.ai.textanalytics.models.ExtractKeyPhraseResult;
-import com.azure.ai.textanalytics.util.ExtractKeyPhrasesResultCollection;
-import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection;
-import com.azure.ai.textanalytics.util.RecognizeLinkedEntitiesResultCollection;
+import com.azure.ai.textanalytics.models.OpinionSentiment;
import com.azure.ai.textanalytics.models.SentenceSentiment;
import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions;
import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics;
import com.azure.ai.textanalytics.models.TextDocumentInput;
+import com.azure.ai.textanalytics.util.AnalyzeSentimentResultCollection;
+import com.azure.ai.textanalytics.util.DetectLanguageResultCollection;
+import com.azure.ai.textanalytics.util.ExtractKeyPhrasesResultCollection;
+import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection;
+import com.azure.ai.textanalytics.util.RecognizeLinkedEntitiesResultCollection;
import com.azure.ai.textanalytics.util.RecognizePiiEntitiesResultCollection;
import com.azure.core.credential.AzureKeyCredential;
@@ -547,12 +550,11 @@ public void analyzeSentiment() {
* Code snippet for {@link TextAnalyticsAsyncClient#analyzeSentiment(String, String)}
*/
public void analyzeSentimentWithLanguage() {
- // BEGIN: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#string-string
+ // BEGIN: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#String-String
String document = "The hotel was dark and unclean.";
textAnalyticsAsyncClient.analyzeSentiment(document, "en")
.subscribe(documentSentiment -> {
System.out.printf("Recognized sentiment label: %s.%n", documentSentiment.getSentiment());
-
for (SentenceSentiment sentenceSentiment : documentSentiment.getSentences()) {
System.out.printf("Recognized sentence sentiment: %s, positive score: %.2f, neutral score: %.2f, "
+ "negative score: %.2f.%n",
@@ -562,7 +564,32 @@ public void analyzeSentimentWithLanguage() {
sentenceSentiment.getConfidenceScores().getNegative());
}
});
- // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#string-string
+ // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#String-String
+ }
+
+ /**
+ * Code snippet for {@link TextAnalyticsAsyncClient#analyzeSentiment(String, String, AnalyzeSentimentOptions)}
+ */
+ public void analyzeSentimentWithLanguageWithOpinionMining() {
+ // BEGIN: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#String-String-AnalyzeSentimentOptions
+ textAnalyticsAsyncClient.analyzeSentiment("The hotel was dark and unclean.", "en",
+ new AnalyzeSentimentOptions().setIncludeOpinionMining(true))
+ .subscribe(documentSentiment -> {
+ for (SentenceSentiment sentenceSentiment : documentSentiment.getSentences()) {
+ System.out.printf("\tSentence sentiment: %s%n", sentenceSentiment.getSentiment());
+ sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> {
+ AspectSentiment aspectSentiment = minedOpinions.getAspect();
+ System.out.printf("\tAspect sentiment: %s, aspect text: %s%n",
+ aspectSentiment.getSentiment(), aspectSentiment.getText());
+ for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) {
+ System.out.printf("\t\t'%s' sentiment because of \"%s\". Is the opinion negated: %s.%n",
+ opinionSentiment.getSentiment(), opinionSentiment.getText(),
+ opinionSentiment.isNegated());
+ }
+ });
+ }
+ });
+ // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentiment#String-String-AnalyzeSentimentOptions
}
/**
@@ -575,7 +602,43 @@ public void analyzeSentimentStringListWithOptions() {
"The restaurant had amazing gnocchi."
);
- textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", null).subscribe(
+ textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en",
+ new TextAnalyticsRequestOptions().setIncludeStatistics(true)).subscribe(
+ response -> {
+ // Batch statistics
+ TextDocumentBatchStatistics batchStatistics = response.getStatistics();
+ System.out.printf("Batch statistics, transaction count: %s, valid document count: %s.%n",
+ batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount());
+
+ response.forEach(analyzeSentimentResult -> {
+ System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId());
+ DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment();
+ System.out.printf("Recognized document sentiment: %s.%n", documentSentiment.getSentiment());
+ documentSentiment.getSentences().forEach(sentenceSentiment ->
+ System.out.printf("Recognized sentence sentiment: %s, positive score: %.2f, "
+ + "neutral score: %.2f, negative score: %.2f.%n",
+ sentenceSentiment.getSentiment(),
+ sentenceSentiment.getConfidenceScores().getPositive(),
+ sentenceSentiment.getConfidenceScores().getNeutral(),
+ sentenceSentiment.getConfidenceScores().getNegative()));
+ });
+ });
+ // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-String-TextAnalyticsRequestOptions
+ }
+
+ /**
+ * Code snippet for {@link TextAnalyticsAsyncClient#analyzeSentimentBatch(Iterable, String, AnalyzeSentimentOptions)}
+ */
+ public void analyzeSentimentStringListWithOptionsAndOpinionMining() {
+ // BEGIN: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-String-AnalyzeSentimentOptions
+ List documents = Arrays.asList(
+ "The hotel was dark and unclean.",
+ "The restaurant had amazing gnocchi."
+ );
+
+ AnalyzeSentimentOptions options = new AnalyzeSentimentOptions().setIncludeOpinionMining(true);
+
+ textAnalyticsAsyncClient.analyzeSentimentBatch(documents, "en", options).subscribe(
response -> {
// Batch statistics
TextDocumentBatchStatistics batchStatistics = response.getStatistics();
@@ -585,17 +648,23 @@ public void analyzeSentimentStringListWithOptions() {
response.forEach(analyzeSentimentResult -> {
System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId());
DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment();
- System.out.printf("Recognized document sentiment: %s.%n", documentSentiment.getSentiment());
- documentSentiment.getSentences().forEach(sentenceSentiment ->
- System.out.printf("Recognized sentence sentiment: %s, positive score: %.2f, "
- + "neutral score: %.2f, negative score: %.2f.%n",
- sentenceSentiment.getSentiment(),
- sentenceSentiment.getConfidenceScores().getPositive(),
- sentenceSentiment.getConfidenceScores().getNeutral(),
- sentenceSentiment.getConfidenceScores().getNegative()));
+ documentSentiment.getSentences().forEach(sentenceSentiment -> {
+ System.out.printf("\tSentence sentiment: %s%n", sentenceSentiment.getSentiment());
+ sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> {
+ AspectSentiment aspectSentiment = minedOpinions.getAspect();
+ System.out.printf("\t\tAspect sentiment: %s, aspect text: %s%n",
+ aspectSentiment.getSentiment(), aspectSentiment.getText());
+ for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) {
+ System.out.printf(
+ "\t\t\t'%s' opinion sentiment because of \"%s\". Is the opinion negated: %s.%n",
+ opinionSentiment.getSentiment(), opinionSentiment.getText(),
+ opinionSentiment.isNegated());
+ }
+ });
+ });
});
});
- // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-String-TextAnalyticsRequestOptions
+ // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-String-AnalyzeSentimentOptions
}
/**
@@ -637,4 +706,50 @@ public void analyzeBatchSentimentMaxOverload() {
});
// END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-TextAnalyticsRequestOptions
}
+
+ /**
+ * Code snippet for {@link TextAnalyticsAsyncClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions)}
+ */
+ public void analyzeBatchSentimentMaxOverloadWithOpinionMining() {
+ // BEGIN: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-AnalyzeSentimentOptions
+ List textDocumentInputs1 = Arrays.asList(
+ new TextDocumentInput("0", "The hotel was dark and unclean.").setLanguage("en"),
+ new TextDocumentInput("1", "The restaurant had amazing gnocchi.").setLanguage("en"));
+
+ // Request options: show statistics and model version
+ AnalyzeSentimentOptions options = new AnalyzeSentimentOptions()
+ .setIncludeOpinionMining(true).setIncludeStatistics(true);
+ textAnalyticsAsyncClient.analyzeSentimentBatchWithResponse(textDocumentInputs1, options)
+ .subscribe(response -> {
+ // Response's status code
+ System.out.printf("Status code of request response: %d%n", response.getStatusCode());
+ AnalyzeSentimentResultCollection resultCollection = response.getValue();
+
+ // Batch statistics
+ TextDocumentBatchStatistics batchStatistics = resultCollection.getStatistics();
+ System.out.printf("Batch statistics, transaction count: %s, valid document count: %s.%n",
+ batchStatistics.getTransactionCount(),
+ batchStatistics.getValidDocumentCount());
+
+ resultCollection.forEach(analyzeSentimentResult -> {
+ System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId());
+ DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment();
+ documentSentiment.getSentences().forEach(sentenceSentiment -> {
+ System.out.printf("\tSentence sentiment: %s%n", sentenceSentiment.getSentiment());
+ sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> {
+ AspectSentiment aspectSentiment = minedOpinions.getAspect();
+ System.out.printf("\t\tAspect sentiment: %s, aspect text: %s%n",
+ aspectSentiment.getSentiment(), aspectSentiment.getText());
+ for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) {
+ System.out.printf(
+ "\t\t\t'%s' opinion sentiment because of \"%s\". Is the opinion negated: %s.%n",
+ opinionSentiment.getSentiment(), opinionSentiment.getText(),
+ opinionSentiment.isNegated());
+ }
+ });
+ });
+ });
+ });
+ // END: com.azure.ai.textanalytics.TextAnalyticsAsyncClient.analyzeSentimentBatch#Iterable-AnalyzeSentimentOptions
+ }
}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsClientJavaDocCodeSnippets.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsClientJavaDocCodeSnippets.java
index 346e5111df914..7a004a6abe9c2 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsClientJavaDocCodeSnippets.java
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/TextAnalyticsClientJavaDocCodeSnippets.java
@@ -3,11 +3,14 @@
package com.azure.ai.textanalytics;
+import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions;
+import com.azure.ai.textanalytics.models.AspectSentiment;
import com.azure.ai.textanalytics.models.CategorizedEntity;
import com.azure.ai.textanalytics.models.CategorizedEntityCollection;
import com.azure.ai.textanalytics.models.DetectLanguageInput;
import com.azure.ai.textanalytics.models.DetectedLanguage;
import com.azure.ai.textanalytics.models.DocumentSentiment;
+import com.azure.ai.textanalytics.models.OpinionSentiment;
import com.azure.ai.textanalytics.models.PiiEntity;
import com.azure.ai.textanalytics.models.SentenceSentiment;
import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions;
@@ -576,6 +579,29 @@ public void analyzeSentimentWithLanguage() {
// END: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentiment#String-String
}
+ /**
+ * Code snippet for {@link TextAnalyticsClient#analyzeSentiment(String, String, AnalyzeSentimentOptions)}
+ */
+ public void analyzeSentimentWithLanguageWithOpinionMining() {
+ // BEGIN: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentiment#String-String-AnalyzeSentimentOptions
+ final DocumentSentiment documentSentiment = textAnalyticsClient.analyzeSentiment(
+ "The hotel was dark and unclean.", "en",
+ new AnalyzeSentimentOptions().setIncludeOpinionMining(true));
+ for (SentenceSentiment sentenceSentiment : documentSentiment.getSentences()) {
+ System.out.printf("\tSentence sentiment: %s%n", sentenceSentiment.getSentiment());
+ sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> {
+ AspectSentiment aspectSentiment = minedOpinions.getAspect();
+ System.out.printf("\tAspect sentiment: %s, aspect text: %s%n", aspectSentiment.getSentiment(),
+ aspectSentiment.getText());
+ for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) {
+ System.out.printf("\t\t'%s' sentiment because of \"%s\". Is the opinion negated: %s.%n",
+ opinionSentiment.getSentiment(), opinionSentiment.getText(), opinionSentiment.isNegated());
+ }
+ });
+ }
+ // END: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentiment#String-String-AnalyzeSentimentOptions
+ }
+
/**
* Code snippet for {@link TextAnalyticsClient#analyzeSentimentBatch(Iterable, String, TextAnalyticsRequestOptions)}
*/
@@ -587,8 +613,8 @@ public void analyzeSentimentStringListWithOptions() {
);
// Analyzing batch sentiments
- AnalyzeSentimentResultCollection resultCollection =
- textAnalyticsClient.analyzeSentimentBatch(documents, "en", null);
+ AnalyzeSentimentResultCollection resultCollection = textAnalyticsClient.analyzeSentimentBatch(
+ documents, "en", new TextAnalyticsRequestOptions().setIncludeStatistics(true));
// Batch statistics
TextDocumentBatchStatistics batchStatistics = resultCollection.getStatistics();
@@ -618,6 +644,40 @@ public void analyzeSentimentStringListWithOptions() {
// END: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-String-TextAnalyticsRequestOptions
}
+ /**
+ * Code snippet for {@link TextAnalyticsClient#analyzeSentimentBatch(Iterable, String, AnalyzeSentimentOptions)}
+ */
+ public void analyzeSentimentStringListWithOptionsAndOpinionMining() {
+ // BEGIN: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-String-AnalyzeSentimentOptions
+ List documents = Arrays.asList(
+ "The hotel was dark and unclean. The restaurant had amazing gnocchi.",
+ "The restaurant had amazing gnocchi. The hotel was dark and unclean."
+ );
+
+ // Analyzing batch sentiments
+ AnalyzeSentimentResultCollection resultCollection = textAnalyticsClient.analyzeSentimentBatch(
+ documents, "en", new AnalyzeSentimentOptions().setIncludeOpinionMining(true));
+
+ // Analyzed sentiment for each of documents from a batch of documents
+ resultCollection.forEach(analyzeSentimentResult -> {
+ System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId());
+ DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment();
+ documentSentiment.getSentences().forEach(sentenceSentiment -> {
+ System.out.printf("\tSentence sentiment: %s%n", sentenceSentiment.getSentiment());
+ sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> {
+ AspectSentiment aspectSentiment = minedOpinions.getAspect();
+ System.out.printf("\tAspect sentiment: %s, aspect text: %s%n", aspectSentiment.getSentiment(),
+ aspectSentiment.getText());
+ for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) {
+ System.out.printf("\t\t'%s' sentiment because of \"%s\". Is the opinion negated: %s.%n",
+ opinionSentiment.getSentiment(), opinionSentiment.getText(), opinionSentiment.isNegated());
+ }
+ });
+ });
+ });
+ // END: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-String-AnalyzeSentimentOptions
+ }
+
/**
* Code snippet for {@link TextAnalyticsClient#analyzeSentimentBatchWithResponse(Iterable, TextAnalyticsRequestOptions, Context)}
*/
@@ -668,4 +728,52 @@ public void analyzeBatchSentimentMaxOverload() {
});
// END: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-TextAnalyticsRequestOptions-Context
}
+
+ /**
+ * Code snippet for {@link TextAnalyticsClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions, Context)}
+ */
+ public void analyzeBatchSentimentMaxOverloadWithOpinionMining() {
+ // BEGIN: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-AnalyzeSentimentOptions-Context
+ List textDocumentInputs = Arrays.asList(
+ new TextDocumentInput("1", "The hotel was dark and unclean. The restaurant had amazing gnocchi.")
+ .setLanguage("en"),
+ new TextDocumentInput("2", "The restaurant had amazing gnocchi. The hotel was dark and unclean.")
+ .setLanguage("en")
+ );
+
+ AnalyzeSentimentOptions options = new AnalyzeSentimentOptions().setIncludeOpinionMining(true)
+ .setIncludeStatistics(true);
+
+ // Analyzing batch sentiments
+ Response response =
+ textAnalyticsClient.analyzeSentimentBatchWithResponse(textDocumentInputs, options, Context.NONE);
+
+ // Response's status code
+ System.out.printf("Status code of request response: %d%n", response.getStatusCode());
+ AnalyzeSentimentResultCollection resultCollection = response.getValue();
+
+ // Batch statistics
+ TextDocumentBatchStatistics batchStatistics = resultCollection.getStatistics();
+ System.out.printf("A batch of documents statistics, transaction count: %s, valid document count: %s.%n",
+ batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount());
+
+ // Analyzed sentiment for each of documents from a batch of documents
+ resultCollection.forEach(analyzeSentimentResult -> {
+ System.out.printf("Document ID: %s%n", analyzeSentimentResult.getId());
+ DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment();
+ documentSentiment.getSentences().forEach(sentenceSentiment -> {
+ System.out.printf("\tSentence sentiment: %s%n", sentenceSentiment.getSentiment());
+ sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> {
+ AspectSentiment aspectSentiment = minedOpinions.getAspect();
+ System.out.printf("\tAspect sentiment: %s, aspect text: %s%n", aspectSentiment.getSentiment(),
+ aspectSentiment.getText());
+ for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) {
+ System.out.printf("\t\t'%s' sentiment because of \"%s\". Is the opinion negated: %s.%n",
+ opinionSentiment.getSentiment(), opinionSentiment.getText(), opinionSentiment.isNegated());
+ }
+ });
+ });
+ });
+ // END: com.azure.ai.textanalytics.TextAnalyticsClient.analyzeSentimentBatch#Iterable-AnalyzeSentimentOptions-Context
+ }
}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocumentsWithOpinionMining.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocumentsWithOpinionMining.java
new file mode 100644
index 0000000000000..0c0f936ab4606
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocumentsWithOpinionMining.java
@@ -0,0 +1,95 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.textanalytics.batch;
+
+import com.azure.ai.textanalytics.TextAnalyticsClient;
+import com.azure.ai.textanalytics.TextAnalyticsClientBuilder;
+import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions;
+import com.azure.ai.textanalytics.models.AspectSentiment;
+import com.azure.ai.textanalytics.models.DocumentSentiment;
+import com.azure.ai.textanalytics.models.OpinionSentiment;
+import com.azure.ai.textanalytics.models.SentimentConfidenceScores;
+import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics;
+import com.azure.ai.textanalytics.models.TextDocumentInput;
+import com.azure.ai.textanalytics.util.AnalyzeSentimentResultCollection;
+import com.azure.core.credential.AzureKeyCredential;
+import com.azure.core.http.rest.Response;
+import com.azure.core.util.Context;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Sample demonstrates how to analyze the sentiments of {@link TextDocumentInput} documents with opinion mining.
+ */
+public class AnalyzeSentimentBatchDocumentsWithOpinionMining {
+ /**
+ * Main method to invoke this demo about how to analyze the sentiments of {@link TextDocumentInput} documents.
+ *
+ * @param args Unused arguments to the program.
+ */
+ public static void main(String[] args) {
+ // Instantiate a client that will be used to call the service.
+ TextAnalyticsClient client = new TextAnalyticsClientBuilder()
+ .credential(new AzureKeyCredential("{key}"))
+ .endpoint("{endpoint}")
+ .buildClient();
+
+ // The texts that need be analyzed.
+ List documents = Arrays.asList(
+ new TextDocumentInput("A", "Great atmosphere. Close to plenty of restaurants, hotels, and transit! Staff are friendly and helpful.").setLanguage("en"),
+ new TextDocumentInput("B", "Bad atmosphere. Not close to plenty of restaurants, hotels, and transit! Staff are not friendly and helpful.").setLanguage("en")
+ );
+
+ AnalyzeSentimentOptions options = new AnalyzeSentimentOptions()
+ .setIncludeOpinionMining(true).setIncludeStatistics(true).setModelVersion("latest");
+
+ // Analyzing sentiment for each document in a batch of documents
+ Response sentimentBatchResultResponse =
+ client.analyzeSentimentBatchWithResponse(documents, options, Context.NONE);
+
+ // Response's status code
+ System.out.printf("Status code of request response: %d%n", sentimentBatchResultResponse.getStatusCode());
+ AnalyzeSentimentResultCollection sentimentBatchResultCollection = sentimentBatchResultResponse.getValue();
+
+ // Model version
+ System.out.printf("Results of Azure Text Analytics \"Sentiment Analysis\" Model, version: %s%n", sentimentBatchResultCollection.getModelVersion());
+
+ // Batch statistics
+ TextDocumentBatchStatistics batchStatistics = sentimentBatchResultCollection.getStatistics();
+ System.out.printf("Documents statistics: document count = %s, erroneous document count = %s, transaction count = %s, valid document count = %s.%n",
+ batchStatistics.getDocumentCount(), batchStatistics.getInvalidDocumentCount(), batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount());
+
+ // Analyzed sentiment for each document in a batch of documents
+ AtomicInteger counter = new AtomicInteger();
+ sentimentBatchResultCollection.forEach(analyzeSentimentResult -> {
+ System.out.printf("%n%s%n", documents.get(counter.getAndIncrement()));
+ if (analyzeSentimentResult.isError()) {
+ // Erroneous document
+ System.out.printf("Cannot analyze sentiment. Error: %s%n", analyzeSentimentResult.getError().getMessage());
+ } else {
+ // Valid document
+ DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment();
+ SentimentConfidenceScores scores = documentSentiment.getConfidenceScores();
+ System.out.printf("Analyzed document sentiment: %s, positive score: %f, neutral score: %f, negative score: %f.%n",
+ documentSentiment.getSentiment(), scores.getPositive(), scores.getNeutral(), scores.getNegative());
+ documentSentiment.getSentences().forEach(sentenceSentiment -> {
+ SentimentConfidenceScores sentenceScores = sentenceSentiment.getConfidenceScores();
+ System.out.printf("\tSentence sentiment: %s, positive score: %f, neutral score: %f, negative score: %f.%n",
+ sentenceSentiment.getSentiment(), sentenceScores.getPositive(), sentenceScores.getNeutral(), sentenceScores.getNegative());
+ sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> {
+ AspectSentiment aspectSentiment = minedOpinions.getAspect();
+ System.out.printf("\t\tAspect sentiment: %s, aspect text: %s%n", aspectSentiment.getSentiment(),
+ aspectSentiment.getText());
+ for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) {
+ System.out.printf("\t\t\t'%s' opinion sentiment because of \"%s\". Is the opinion negated: %s.%n",
+ opinionSentiment.getSentiment(), opinionSentiment.getText(), opinionSentiment.isNegated());
+ }
+ });
+ });
+ }
+ });
+ }
+}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocumentsWithOpinionMiningAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocumentsWithOpinionMiningAsync.java
new file mode 100644
index 0000000000000..50b8acde5803b
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchDocumentsWithOpinionMiningAsync.java
@@ -0,0 +1,105 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.textanalytics.batch;
+
+import com.azure.ai.textanalytics.TextAnalyticsAsyncClient;
+import com.azure.ai.textanalytics.TextAnalyticsClientBuilder;
+import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions;
+import com.azure.ai.textanalytics.models.AnalyzeSentimentResult;
+import com.azure.ai.textanalytics.models.AspectSentiment;
+import com.azure.ai.textanalytics.models.DocumentSentiment;
+import com.azure.ai.textanalytics.models.OpinionSentiment;
+import com.azure.ai.textanalytics.models.SentimentConfidenceScores;
+import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics;
+import com.azure.ai.textanalytics.models.TextDocumentInput;
+import com.azure.ai.textanalytics.util.AnalyzeSentimentResultCollection;
+import com.azure.core.credential.AzureKeyCredential;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Sample demonstrates how to asynchronously analyze the sentiments of {@link TextDocumentInput} documents with
+ * opinion mining.
+ */
+public class AnalyzeSentimentBatchDocumentsWithOpinionMiningAsync {
+ /**
+ * Main method to invoke this demo about how to analyze the sentiments of {@link TextDocumentInput} documents.
+ *
+ * @param args Unused arguments to the program.
+ */
+ public static void main(String[] args) {
+ // Instantiate a client that will be used to call the service.
+ TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder()
+ .credential(new AzureKeyCredential("{key}"))
+ .endpoint("{endpoint}")
+ .buildAsyncClient();
+
+ // The texts that need be analyzed.
+ List documents = Arrays.asList(
+ new TextDocumentInput("A", "Great atmosphere. Close to plenty of restaurants, hotels, and transit! Staff are friendly and helpful.").setLanguage("en"),
+ new TextDocumentInput("B", "Bad atmosphere. Not close to plenty of restaurants, hotels, and transit! Staff are not friendly and helpful.").setLanguage("en")
+ );
+
+ AnalyzeSentimentOptions options = new AnalyzeSentimentOptions()
+ .setIncludeOpinionMining(true).setIncludeStatistics(true).setModelVersion("latest");
+
+ // Analyzing sentiment for each document in a batch of documents
+ client.analyzeSentimentBatchWithResponse(documents, options).subscribe(
+ sentimentBatchResultResponse -> {
+ // Response's status code
+ System.out.printf("Status code of request response: %d%n", sentimentBatchResultResponse.getStatusCode());
+ AnalyzeSentimentResultCollection sentimentBatchResultCollection = sentimentBatchResultResponse.getValue();
+
+ System.out.printf("Results of Azure Text Analytics \"Sentiment Analysis\" Model, version: %s%n", sentimentBatchResultCollection.getModelVersion());
+
+ // Batch statistics
+ TextDocumentBatchStatistics batchStatistics = sentimentBatchResultCollection.getStatistics();
+ System.out.printf("Documents statistics: document count = %s, erroneous document count = %s, transaction count = %s, valid document count = %s.%n",
+ batchStatistics.getDocumentCount(), batchStatistics.getInvalidDocumentCount(), batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount());
+
+ // Analyzed sentiment for each document in a batch of documents
+ AtomicInteger counter = new AtomicInteger();
+ for (AnalyzeSentimentResult analyzeSentimentResult : sentimentBatchResultCollection) {
+ System.out.printf("%n%s%n", documents.get(counter.getAndIncrement()));
+ if (analyzeSentimentResult.isError()) {
+ // Erroneous document
+ System.out.printf("Cannot analyze sentiment. Error: %s%n", analyzeSentimentResult.getError().getMessage());
+ } else {
+ // Valid document
+ DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment();
+ SentimentConfidenceScores scores = documentSentiment.getConfidenceScores();
+ System.out.printf("Analyzed document sentiment: %s, positive score: %f, neutral score: %f, negative score: %f.%n",
+ documentSentiment.getSentiment(), scores.getPositive(), scores.getNeutral(), scores.getNegative());
+ documentSentiment.getSentences().forEach(sentenceSentiment -> {
+ SentimentConfidenceScores sentenceScores = sentenceSentiment.getConfidenceScores();
+ System.out.printf("\tSentence sentiment: %s, positive score: %f, neutral score: %f, negative score: %f.%n",
+ sentenceSentiment.getSentiment(), sentenceScores.getPositive(), sentenceScores.getNeutral(), sentenceScores.getNegative());
+ sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> {
+ AspectSentiment aspectSentiment = minedOpinions.getAspect();
+ System.out.printf("\t\tAspect sentiment: %s, aspect text: %s%n", aspectSentiment.getSentiment(),
+ aspectSentiment.getText());
+ for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) {
+ System.out.printf("\t\t\t'%s' opinion sentiment because of \"%s\". Is the opinion negated: %s.%n",
+ opinionSentiment.getSentiment(), opinionSentiment.getText(), opinionSentiment.isNegated());
+ }
+ });
+ });
+ }
+ }
+ },
+ error -> System.err.println("There was an error analyzing sentiment of the documents." + error),
+ () -> System.out.println("Batch of sentiment analyzed."));
+
+ // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep
+ // the thread so the program does not end before the send operation is complete. Using .block() instead of
+ // .subscribe() will turn this into a synchronous call.
+ try {
+ TimeUnit.SECONDS.sleep(5);
+ } catch (InterruptedException ignored) {
+ }
+ }
+}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchStringWithOpinionMining.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchStringWithOpinionMining.java
new file mode 100644
index 0000000000000..0508152e9b307
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchStringWithOpinionMining.java
@@ -0,0 +1,78 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.textanalytics.batch;
+
+import com.azure.ai.textanalytics.TextAnalyticsClient;
+import com.azure.ai.textanalytics.TextAnalyticsClientBuilder;
+import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions;
+import com.azure.ai.textanalytics.models.AnalyzeSentimentResult;
+import com.azure.ai.textanalytics.models.AspectSentiment;
+import com.azure.ai.textanalytics.models.DocumentSentiment;
+import com.azure.ai.textanalytics.models.OpinionSentiment;
+import com.azure.ai.textanalytics.models.SentimentConfidenceScores;
+import com.azure.ai.textanalytics.models.TextDocumentInput;
+import com.azure.ai.textanalytics.util.AnalyzeSentimentResultCollection;
+import com.azure.core.credential.AzureKeyCredential;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Sample demonstrates how to analyze the sentiments of {@code String} documents with opinion mining.
+ */
+public class AnalyzeSentimentBatchStringWithOpinionMining {
+ /**
+ * Main method to invoke this demo about how to analyze the sentiments of {@link TextDocumentInput} documents.
+ *
+ * @param args Unused arguments to the program.
+ */
+ public static void main(String[] args) {
+ // Instantiate a client that will be used to call the service.
+ TextAnalyticsClient client = new TextAnalyticsClientBuilder()
+ .credential(new AzureKeyCredential("{key}"))
+ .endpoint("{endpoint}")
+ .buildClient();
+
+ // The documents that need to be analyzed.
+ List documents = Arrays.asList(
+ "Great atmosphere. Close to plenty of restaurants, hotels, and transit! Staff are friendly and helpful.",
+ "Bad atmosphere. Not close to plenty of restaurants, hotels, and transit! Staff are not friendly and helpful."
+ );
+
+ AnalyzeSentimentOptions options = new AnalyzeSentimentOptions()
+ .setIncludeOpinionMining(true).setIncludeStatistics(true).setModelVersion("latest");
+
+ // Analyzing sentiment for each document in a batch of documents
+ AnalyzeSentimentResultCollection sentimentBatchResultCollection = client.analyzeSentimentBatch(documents, "en", options);
+
+ // Model version
+ System.out.printf("Results of Azure Text Analytics \"Sentiment Analysis\" Model, version: %s%n", sentimentBatchResultCollection.getModelVersion());
+
+ // Analyzed sentiment for each document in a batch of documents
+ AtomicInteger counter = new AtomicInteger();
+ for (AnalyzeSentimentResult analyzeSentimentResult : sentimentBatchResultCollection) {
+ System.out.printf("%nText = %s%n", documents.get(counter.getAndIncrement()));
+ DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment();
+
+ SentimentConfidenceScores scores = documentSentiment.getConfidenceScores();
+ System.out.printf("Analyzed document sentiment: %s, positive score: %f, neutral score: %f, negative score: %f.%n",
+ documentSentiment.getSentiment(), scores.getPositive(), scores.getNeutral(), scores.getNegative());
+ documentSentiment.getSentences().forEach(sentenceSentiment -> {
+ SentimentConfidenceScores sentenceScores = sentenceSentiment.getConfidenceScores();
+ System.out.printf("\tSentence sentiment: %s, positive score: %f, neutral score: %f, negative score: %f.%n",
+ sentenceSentiment.getSentiment(), sentenceScores.getPositive(), sentenceScores.getNeutral(), sentenceScores.getNegative());
+ sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> {
+ AspectSentiment aspectSentiment = minedOpinions.getAspect();
+ System.out.printf("\t\tAspect sentiment: %s, aspect text: %s%n", aspectSentiment.getSentiment(),
+ aspectSentiment.getText());
+ for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) {
+ System.out.printf("\t\t\t'%s' opinion sentiment because of \"%s\". Is the opinion negated: %s.%n",
+ opinionSentiment.getSentiment(), opinionSentiment.getText(), opinionSentiment.isNegated());
+ }
+ });
+ });
+ }
+ }
+}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchStringWithOpinionMiningAsync.java b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchStringWithOpinionMiningAsync.java
new file mode 100644
index 0000000000000..43e28939f213a
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/samples/java/com/azure/ai/textanalytics/batch/AnalyzeSentimentBatchStringWithOpinionMiningAsync.java
@@ -0,0 +1,100 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.textanalytics.batch;
+
+import com.azure.ai.textanalytics.TextAnalyticsAsyncClient;
+import com.azure.ai.textanalytics.TextAnalyticsClientBuilder;
+import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions;
+import com.azure.ai.textanalytics.models.AnalyzeSentimentResult;
+import com.azure.ai.textanalytics.models.AspectSentiment;
+import com.azure.ai.textanalytics.models.DocumentSentiment;
+import com.azure.ai.textanalytics.models.OpinionSentiment;
+import com.azure.ai.textanalytics.models.SentimentConfidenceScores;
+import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics;
+import com.azure.core.credential.AzureKeyCredential;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * Sample demonstrates how to asynchronously analyze the sentiments of {@code String} documents with opinion mining.
+ */
+public class AnalyzeSentimentBatchStringWithOpinionMiningAsync {
+
+ /**
+ * Main method to invoke this demo about how to analyze the sentiments of {@code String} documents.
+ *
+ * @param args Unused arguments to the program.
+ */
+ public static void main(String[] args) {
+ // Instantiate a client that will be used to call the service.
+ TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder()
+ .credential(new AzureKeyCredential("{key}"))
+ .endpoint("{endpoint}")
+ .buildAsyncClient();
+
+ // The texts that need be analyzed.
+ List documents = Arrays.asList(
+ "Great atmosphere. Close to plenty of restaurants, hotels, and transit! Staff are friendly and helpful.",
+ "Bad atmosphere. Not close to plenty of restaurants, hotels, and transit! Staff are not friendly and helpful."
+ );
+
+ AnalyzeSentimentOptions options = new AnalyzeSentimentOptions()
+ .setIncludeOpinionMining(true).setIncludeStatistics(true).setModelVersion("latest");
+
+ // Analyzing sentiment for each document in a batch of documents
+ client.analyzeSentimentBatch(documents, "en", options).subscribe(
+ sentimentBatchResultCollection -> {
+ System.out.printf("Results of Azure Text Analytics \"Sentiment Analysis\" Model, version: %s%n", sentimentBatchResultCollection.getModelVersion());
+
+ // Batch statistics
+ TextDocumentBatchStatistics batchStatistics = sentimentBatchResultCollection.getStatistics();
+ System.out.printf("Documents statistics: document count = %s, erroneous document count = %s, transaction count = %s, valid document count = %s.%n",
+ batchStatistics.getDocumentCount(), batchStatistics.getInvalidDocumentCount(), batchStatistics.getTransactionCount(), batchStatistics.getValidDocumentCount());
+
+ // Analyzed sentiment for each document in a batch of documents
+ AtomicInteger counter = new AtomicInteger();
+ for (AnalyzeSentimentResult analyzeSentimentResult : sentimentBatchResultCollection) {
+ // Analyzed sentiment for each document
+ System.out.printf("%nText = %s%n", documents.get(counter.getAndIncrement()));
+ if (analyzeSentimentResult.isError()) {
+ // Erroneous document
+ System.out.printf("Cannot analyze sentiment. Error: %s%n", analyzeSentimentResult.getError().getMessage());
+ } else {
+ // Valid document
+ DocumentSentiment documentSentiment = analyzeSentimentResult.getDocumentSentiment();
+ SentimentConfidenceScores scores = documentSentiment.getConfidenceScores();
+ System.out.printf("Analyzed document sentiment: %s, positive score: %f, neutral score: %f, negative score: %f.%n",
+ documentSentiment.getSentiment(), scores.getPositive(), scores.getNeutral(), scores.getNegative());
+ documentSentiment.getSentences().forEach(sentenceSentiment -> {
+ SentimentConfidenceScores sentenceScores = sentenceSentiment.getConfidenceScores();
+ System.out.printf("\tSentence sentiment: %s, positive score: %f, neutral score: %f, negative score: %f.%n",
+ sentenceSentiment.getSentiment(), sentenceScores.getPositive(), sentenceScores.getNeutral(), sentenceScores.getNegative());
+ sentenceSentiment.getMinedOpinions().forEach(minedOpinions -> {
+ AspectSentiment aspectSentiment = minedOpinions.getAspect();
+ System.out.printf("\t\tAspect sentiment: %s, aspect text: %s%n", aspectSentiment.getSentiment(),
+ aspectSentiment.getText());
+ for (OpinionSentiment opinionSentiment : minedOpinions.getOpinions()) {
+ System.out.printf("\t\t\t'%s' opinion sentiment because of \"%s\". Is the opinion negated: %s.%n",
+ opinionSentiment.getSentiment(), opinionSentiment.getText(), opinionSentiment.isNegated());
+ }
+ });
+ });
+ }
+ }
+ },
+ error -> System.err.println("There was an error analyzing sentiment of the documents." + error),
+ () -> System.out.println("Batch of sentiment analyzed."));
+
+ // The .subscribe() creation and assignment is not a blocking call. For the purpose of this example, we sleep
+ // the thread so the program does not end before the send operation is complete. Using .block() instead of
+ // .subscribe() will turn this into a synchronous call.
+ try {
+ TimeUnit.SECONDS.sleep(5);
+ } catch (InterruptedException ignored) {
+ }
+ }
+}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/DocumentInputAsyncTest.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/DocumentInputAsyncTest.java
index a00a8c8137a93..ff6fca3990d3b 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/DocumentInputAsyncTest.java
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/DocumentInputAsyncTest.java
@@ -617,7 +617,7 @@ public void analyzeSentimentNullInputWithLanguageHint() {
*/
@Test
public void analyzeSentimentBatchNullInput() {
- StepVerifier.create(client.analyzeSentimentBatch(null, null, null))
+ StepVerifier.create(client.analyzeSentimentBatch(null, null, new TextAnalyticsRequestOptions()))
.verifyErrorSatisfies(exception -> {
assertEquals(NullPointerException.class, exception.getClass());
assertTrue(INVALID_DOCUMENT_BATCH_NPE_MESSAGE.equals(exception.getMessage()));
@@ -630,7 +630,7 @@ public void analyzeSentimentBatchNullInput() {
*/
@Test
public void analyzeSentimentBatchEmptyInputList() {
- StepVerifier.create(client.analyzeSentimentBatch(Collections.emptyList(), null, null))
+ StepVerifier.create(client.analyzeSentimentBatch(Collections.emptyList(), null, new TextAnalyticsRequestOptions()))
.verifyErrorSatisfies(exception -> {
assertEquals(IllegalArgumentException.class, exception.getClass());
assertTrue(INVALID_DOCUMENT_EMPTY_LIST_EXCEPTION_MESSAGE.equals(exception.getMessage()));
@@ -643,7 +643,7 @@ public void analyzeSentimentBatchEmptyInputList() {
*/
@Test
public void analyzeSentimentBatchNullInputWithLanguageHint() {
- StepVerifier.create(client.analyzeSentimentBatch(null, "en", null))
+ StepVerifier.create(client.analyzeSentimentBatch(null, "en", new TextAnalyticsRequestOptions()))
.verifyErrorSatisfies(exception -> {
assertEquals(NullPointerException.class, exception.getClass());
assertTrue(INVALID_DOCUMENT_BATCH_NPE_MESSAGE.equals(exception.getMessage()));
@@ -656,7 +656,7 @@ public void analyzeSentimentBatchNullInputWithLanguageHint() {
*/
@Test
public void analyzeSentimentBatchEmptyInputListWithLanguageHint() {
- StepVerifier.create(client.analyzeSentimentBatch(Collections.emptyList(), "en", null))
+ StepVerifier.create(client.analyzeSentimentBatch(Collections.emptyList(), "en", new TextAnalyticsRequestOptions()))
.verifyErrorSatisfies(exception -> {
assertEquals(IllegalArgumentException.class, exception.getClass());
assertTrue(INVALID_DOCUMENT_EMPTY_LIST_EXCEPTION_MESSAGE.equals(exception.getMessage()));
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/DocumentInputTest.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/DocumentInputTest.java
index e8e74f2e7167d..308d3c779d76a 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/DocumentInputTest.java
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/DocumentInputTest.java
@@ -535,7 +535,7 @@ public void analyzeSentimentNullInputWithLanguageHint() {
@Test
public void analyzeSentimentBatchNullInput() {
Exception exception = assertThrows(NullPointerException.class, () ->
- client.analyzeSentimentBatch(null, null, null));
+ client.analyzeSentimentBatch(null, null, new TextAnalyticsRequestOptions()));
assertTrue(INVALID_DOCUMENT_BATCH_NPE_MESSAGE.equals(exception.getMessage()));
}
@@ -546,7 +546,7 @@ public void analyzeSentimentBatchNullInput() {
@Test
public void analyzeSentimentBatchEmptyInputList() {
Exception exception = assertThrows(IllegalArgumentException.class, () ->
- client.analyzeSentimentBatch(Collections.emptyList(), null, null));
+ client.analyzeSentimentBatch(Collections.emptyList(), null, new TextAnalyticsRequestOptions()));
assertTrue(INVALID_DOCUMENT_EMPTY_LIST_EXCEPTION_MESSAGE.equals(exception.getMessage()));
}
@@ -557,7 +557,7 @@ public void analyzeSentimentBatchEmptyInputList() {
@Test
public void analyzeSentimentBatchNullInputWithLanguageHint() {
Exception exception = assertThrows(NullPointerException.class, () ->
- client.analyzeSentimentBatch(null, "en", null));
+ client.analyzeSentimentBatch(null, "en", new TextAnalyticsRequestOptions()));
assertTrue(INVALID_DOCUMENT_BATCH_NPE_MESSAGE.equals(exception.getMessage()));
}
@@ -568,7 +568,7 @@ public void analyzeSentimentBatchNullInputWithLanguageHint() {
@Test
public void analyzeSentimentBatchEmptyInputListWithLanguageHint() {
Exception exception = assertThrows(IllegalArgumentException.class, () ->
- client.analyzeSentimentBatch(Collections.emptyList(), "en", null));
+ client.analyzeSentimentBatch(Collections.emptyList(), "en", new TextAnalyticsRequestOptions()));
assertTrue(INVALID_DOCUMENT_EMPTY_LIST_EXCEPTION_MESSAGE.equals(exception.getMessage()));
}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/ReferencePointerParseTest.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/ReferencePointerParseTest.java
new file mode 100644
index 0000000000000..3b5a2b6d2e919
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/ReferencePointerParseTest.java
@@ -0,0 +1,136 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.ai.textanalytics;
+
+import com.azure.ai.textanalytics.implementation.TextAnalyticsClientImpl;
+import com.azure.ai.textanalytics.implementation.models.DocumentSentiment;
+import com.azure.ai.textanalytics.implementation.models.SentenceOpinion;
+import com.azure.ai.textanalytics.implementation.models.SentenceSentiment;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+/**
+ * Unit tests for Aspect relation's reference parse
+ */
+public class ReferencePointerParseTest {
+
+ @Mock
+ private TextAnalyticsClientImpl textAnalyticsClientImpl;
+
+ @BeforeEach
+ void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @AfterEach
+ void teardown() {
+ Mockito.framework().clearInlineMocks();
+ }
+
+ private AnalyzeSentimentAsyncClient analyzeSentimentAsyncClient = new AnalyzeSentimentAsyncClient(textAnalyticsClientImpl);
+
+ private static final String INVALID_POINTER_EXCEPTION = "'%s' is not a valid opinion pointer.";
+ private static final String INVALID_DOCUMENT_INDEX_EXCEPTION = "Invalid document index '%s' in '%s'.";
+ private static final String INVALID_SENTENCE_INDEX_EXCEPTION = "Invalid sentence index '%s' in '%s'.";
+ private static final String INVALID_OPINION_INDEX_EXCEPTION = "Invalid opinion index '%s' in '%s'.";
+ private static final String VALID_OPINION_POINTER = "#/documents/1/sentences/3/opinions/5";
+
+ @Test
+ public void parseRefPointerToIndexArrayTest() {
+ final int[] indexArray = analyzeSentimentAsyncClient.parseRefPointerToIndexArray(VALID_OPINION_POINTER);
+ assertEquals(1, indexArray[0]);
+ assertEquals(3, indexArray[1]);
+ assertEquals(5, indexArray[2]);
+ }
+
+ @Test
+ public void parseInvalidNamePatternStringTest() {
+ final String referencePointer = "#/a/1/b/2/c/3";
+ final IllegalStateException illegalStateException = assertThrows(IllegalStateException.class, () ->
+ analyzeSentimentAsyncClient.parseRefPointerToIndexArray(referencePointer));
+ assertEquals(String.format(INVALID_POINTER_EXCEPTION, referencePointer), illegalStateException.getMessage());
+ }
+
+ @Test
+ public void parseInvalidNumberFormatStringTest() {
+ final String referencePointer = "#/documents/a/sentences/b/opinions/c";
+ final IllegalStateException illegalStateException = assertThrows(IllegalStateException.class, () ->
+ analyzeSentimentAsyncClient.parseRefPointerToIndexArray(referencePointer));
+ assertEquals(String.format(INVALID_POINTER_EXCEPTION, referencePointer), illegalStateException.getMessage());
+ }
+
+ @Test
+ public void parseIncompleteReferencePointerStringTest() {
+ final String referencePointer = "#/documents/1/sentences/2";
+ final IllegalStateException illegalStateException = assertThrows(IllegalStateException.class, () ->
+ analyzeSentimentAsyncClient.parseRefPointerToIndexArray(referencePointer));
+ assertEquals(String.format(INVALID_POINTER_EXCEPTION, referencePointer), illegalStateException.getMessage());
+ }
+
+ @Test
+ public void findSentimentOpinion() {
+ final SentenceOpinion sentenceOpinion = analyzeSentimentAsyncClient.findSentimentOpinion(VALID_OPINION_POINTER, getDocumentSentiments());
+ assertEquals(SentenceOpinion.class, sentenceOpinion.getClass());
+ }
+
+ @Test
+ public void findSentimentOpinionWithInvalidDocumentIndex() {
+ final String referencePointer = "#/documents/2/sentences/1/opinions/1";
+ final IllegalStateException illegalStateException = assertThrows(IllegalStateException.class, () ->
+ analyzeSentimentAsyncClient.findSentimentOpinion(referencePointer, getDocumentSentiments()));
+ assertEquals(String.format(INVALID_DOCUMENT_INDEX_EXCEPTION, 2, referencePointer), illegalStateException.getMessage());
+ }
+
+ @Test
+ public void findSentimentOpinionWithInvalidSentenceIndex() {
+ final String referencePointer = "#/documents/1/sentences/4/opinions/1";
+ final IllegalStateException illegalStateException = assertThrows(IllegalStateException.class, () ->
+ analyzeSentimentAsyncClient.findSentimentOpinion(referencePointer, getDocumentSentiments()));
+ assertEquals(String.format(INVALID_SENTENCE_INDEX_EXCEPTION, 4, referencePointer), illegalStateException.getMessage());
+ }
+
+ @Test
+ public void findSentimentOpinionWithInvalidOpinionIndex() {
+ final String referencePointer = "#/documents/1/sentences/3/opinions/6";
+ final IllegalStateException illegalStateException = assertThrows(IllegalStateException.class, () ->
+ analyzeSentimentAsyncClient.findSentimentOpinion(referencePointer, getDocumentSentiments()));
+ assertEquals(String.format(INVALID_OPINION_INDEX_EXCEPTION, 6, referencePointer), illegalStateException.getMessage());
+ }
+
+ private List getDocumentSentiments() {
+ List documentSentiments = new ArrayList<>();
+ for (int i = 0; i < 2; i++) {
+ documentSentiments.add(new DocumentSentiment()
+ .setId(Integer.toString(i))
+ .setSentences(getSentenceSentiments()));
+ }
+ return documentSentiments;
+ }
+
+ private List getSentenceSentiments() {
+ List sentenceSentiments = new ArrayList<>();
+ for (int i = 0; i < 4; i++) {
+ sentenceSentiments.add(new SentenceSentiment().setOpinions(getSentenceOpinions()));
+ }
+ return sentenceSentiments;
+ }
+
+ private List getSentenceOpinions() {
+ final List sentenceOpinions = new ArrayList<>();
+ for (int i = 0; i < 6; i++) {
+ sentenceOpinions.add(new SentenceOpinion());
+ }
+ return sentenceOpinions;
+ }
+}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TestUtils.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TestUtils.java
index 7ebb0b86793ec..f364077e39e69 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TestUtils.java
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TestUtils.java
@@ -4,34 +4,37 @@
package com.azure.ai.textanalytics;
import com.azure.ai.textanalytics.models.AnalyzeSentimentResult;
-import com.azure.ai.textanalytics.models.PiiEntity;
-import com.azure.ai.textanalytics.models.PiiEntityCollection;
-import com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult;
-import com.azure.ai.textanalytics.util.AnalyzeSentimentResultCollection;
+import com.azure.ai.textanalytics.models.AspectSentiment;
import com.azure.ai.textanalytics.models.CategorizedEntity;
import com.azure.ai.textanalytics.models.CategorizedEntityCollection;
import com.azure.ai.textanalytics.models.DetectLanguageInput;
import com.azure.ai.textanalytics.models.DetectLanguageResult;
-import com.azure.ai.textanalytics.util.DetectLanguageResultCollection;
import com.azure.ai.textanalytics.models.DetectedLanguage;
import com.azure.ai.textanalytics.models.DocumentSentiment;
import com.azure.ai.textanalytics.models.EntityCategory;
import com.azure.ai.textanalytics.models.ExtractKeyPhraseResult;
-import com.azure.ai.textanalytics.util.ExtractKeyPhrasesResultCollection;
import com.azure.ai.textanalytics.models.KeyPhrasesCollection;
import com.azure.ai.textanalytics.models.LinkedEntity;
import com.azure.ai.textanalytics.models.LinkedEntityCollection;
import com.azure.ai.textanalytics.models.LinkedEntityMatch;
+import com.azure.ai.textanalytics.models.MinedOpinion;
+import com.azure.ai.textanalytics.models.OpinionSentiment;
+import com.azure.ai.textanalytics.models.PiiEntity;
+import com.azure.ai.textanalytics.models.PiiEntityCollection;
import com.azure.ai.textanalytics.models.RecognizeEntitiesResult;
-import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection;
import com.azure.ai.textanalytics.models.RecognizeLinkedEntitiesResult;
-import com.azure.ai.textanalytics.util.RecognizeLinkedEntitiesResultCollection;
+import com.azure.ai.textanalytics.models.RecognizePiiEntitiesResult;
import com.azure.ai.textanalytics.models.SentenceSentiment;
import com.azure.ai.textanalytics.models.SentimentConfidenceScores;
import com.azure.ai.textanalytics.models.TextDocumentBatchStatistics;
import com.azure.ai.textanalytics.models.TextDocumentInput;
import com.azure.ai.textanalytics.models.TextDocumentStatistics;
import com.azure.ai.textanalytics.models.TextSentiment;
+import com.azure.ai.textanalytics.util.AnalyzeSentimentResultCollection;
+import com.azure.ai.textanalytics.util.DetectLanguageResultCollection;
+import com.azure.ai.textanalytics.util.ExtractKeyPhrasesResultCollection;
+import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection;
+import com.azure.ai.textanalytics.util.RecognizeLinkedEntitiesResultCollection;
import com.azure.ai.textanalytics.util.RecognizePiiEntitiesResultCollection;
import com.azure.core.exception.HttpResponseException;
import com.azure.core.http.HttpClient;
@@ -50,6 +53,7 @@
import static com.azure.core.test.TestBase.AZURE_TEST_SERVICE_VERSIONS_VALUE_ALL;
import static com.azure.core.test.TestBase.getHttpClients;
+import static java.util.Arrays.asList;
/**
* Contains helper methods for generating inputs for test methods
@@ -62,45 +66,45 @@ final class TestUtils {
static final String FAKE_API_KEY = "1234567890";
static final String AZURE_TEXT_ANALYTICS_API_KEY = "AZURE_TEXT_ANALYTICS_API_KEY";
- static final List SENTIMENT_INPUTS = Arrays.asList("The hotel was dark and unclean. The restaurant had amazing gnocchi.",
+ static final List SENTIMENT_INPUTS = asList("The hotel was dark and unclean. The restaurant had amazing gnocchi.",
"The restaurant had amazing gnocchi. The hotel was dark and unclean.");
- static final List CATEGORIZED_ENTITY_INPUTS = Arrays.asList(
+ static final List CATEGORIZED_ENTITY_INPUTS = asList(
"I had a wonderful trip to Seattle last week.", "I work at Microsoft.");
- static final List PII_ENTITY_INPUTS = Arrays.asList(
+ static final List PII_ENTITY_INPUTS = asList(
"Microsoft employee with ssn 859-98-0987 is using our awesome API's.",
"Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.");
- static final List LINKED_ENTITY_INPUTS = Arrays.asList(
+ static final List LINKED_ENTITY_INPUTS = asList(
"I had a wonderful trip to Seattle last week.",
"I work at Microsoft.");
- static final List KEY_PHRASE_INPUTS = Arrays.asList(
+ static final List KEY_PHRASE_INPUTS = asList(
"Hello world. This is some input text that I love.",
"Bonjour tout le monde");
static final String TOO_LONG_INPUT = "Thisisaveryveryverylongtextwhichgoesonforalongtimeandwhichalmostdoesn'tseemtostopatanygivenpointintime.ThereasonforthistestistotryandseewhathappenswhenwesubmitaveryveryverylongtexttoLanguage.Thisshouldworkjustfinebutjustincaseitisalwaysgoodtohaveatestcase.ThisallowsustotestwhathappensifitisnotOK.Ofcourseitisgoingtobeokbutthenagainitisalsobettertobesure!";
- static final List KEY_PHRASE_FRENCH_INPUTS = Arrays.asList(
+ static final List KEY_PHRASE_FRENCH_INPUTS = asList(
"Bonjour tout le monde.",
"Je m'appelle Mondly.");
- static final List DETECT_LANGUAGE_INPUTS = Arrays.asList(
+ static final List DETECT_LANGUAGE_INPUTS = asList(
"This is written in English", "Este es un documento escrito en Español.", "~@!~:)");
// "personal" and "social" are common to both English and Spanish and if given with limited context the
// response will be based on the "US" country hint. If the origin of the text is known to be coming from
// Spanish that can be given as a hint.
- static final List SPANISH_SAME_AS_ENGLISH_INPUTS = Arrays.asList("personal", "social");
+ static final List SPANISH_SAME_AS_ENGLISH_INPUTS = asList("personal", "social");
static final DetectedLanguage DETECTED_LANGUAGE_SPANISH = new DetectedLanguage("Spanish", "es", 1.0, null);
static final DetectedLanguage DETECTED_LANGUAGE_ENGLISH = new DetectedLanguage("English", "en", 1.0, null);
- static final List DETECT_SPANISH_LANGUAGE_RESULTS = Arrays.asList(
+ static final List DETECT_SPANISH_LANGUAGE_RESULTS = asList(
DETECTED_LANGUAGE_SPANISH, DETECTED_LANGUAGE_SPANISH);
- static final List DETECT_ENGLISH_LANGUAGE_RESULTS = Arrays.asList(
+ static final List DETECT_ENGLISH_LANGUAGE_RESULTS = asList(
DETECTED_LANGUAGE_ENGLISH, DETECTED_LANGUAGE_ENGLISH);
static final HttpResponseException HTTP_RESPONSE_EXCEPTION_CLASS = new HttpResponseException("", null);
@@ -110,7 +114,7 @@ final class TestUtils {
"AZURE_TEXT_ANALYTICS_TEST_SERVICE_VERSIONS";
static List getDetectLanguageInputs() {
- return Arrays.asList(
+ return asList(
new DetectLanguageInput("0", DETECT_LANGUAGE_INPUTS.get(0), "US"),
new DetectLanguageInput("1", DETECT_LANGUAGE_INPUTS.get(1), "US"),
new DetectLanguageInput("2", DETECT_LANGUAGE_INPUTS.get(2), "US")
@@ -118,14 +122,14 @@ static List getDetectLanguageInputs() {
}
static List getDuplicateIdDetectLanguageInputs() {
- return Arrays.asList(
+ return asList(
new DetectLanguageInput("0", DETECT_LANGUAGE_INPUTS.get(0), "US"),
new DetectLanguageInput("0", DETECT_LANGUAGE_INPUTS.get(0), "US")
);
}
static List getDuplicateTextDocumentInputs() {
- return Arrays.asList(
+ return asList(
new TextDocumentInput("0", CATEGORIZED_ENTITY_INPUTS.get(0)),
new TextDocumentInput("0", CATEGORIZED_ENTITY_INPUTS.get(0)),
new TextDocumentInput("0", CATEGORIZED_ENTITY_INPUTS.get(0))
@@ -133,7 +137,7 @@ static List getDuplicateTextDocumentInputs() {
}
static List getWarningsTextDocumentInputs() {
- return Arrays.asList(
+ return asList(
new TextDocumentInput("0", TOO_LONG_INPUT),
new TextDocumentInput("1", CATEGORIZED_ENTITY_INPUTS.get(1))
);
@@ -153,7 +157,7 @@ static List getTextDocumentInputs(List inputs) {
*/
static DetectLanguageResultCollection getExpectedBatchDetectedLanguages() {
final TextDocumentBatchStatistics textDocumentBatchStatistics = new TextDocumentBatchStatistics(3, 3, 0, 3);
- final List detectLanguageResultList = Arrays.asList(
+ final List detectLanguageResultList = asList(
new DetectLanguageResult("0", new TextDocumentStatistics(26, 1), null, getDetectedLanguageEnglish()),
new DetectLanguageResult("1", new TextDocumentStatistics(40, 1), null, getDetectedLanguageSpanish()),
new DetectLanguageResult("2", new TextDocumentStatistics(6, 1), null, getUnknownDetectedLanguage()));
@@ -179,7 +183,7 @@ static DetectedLanguage getUnknownDetectedLanguage() {
*/
static RecognizeEntitiesResultCollection getExpectedBatchCategorizedEntities() {
return new RecognizeEntitiesResultCollection(
- Arrays.asList(getExpectedBatchCategorizedEntities1(), getExpectedBatchCategorizedEntities2()),
+ asList(getExpectedBatchCategorizedEntities1(), getExpectedBatchCategorizedEntities2()),
DEFAULT_MODEL_VERSION,
new TextDocumentBatchStatistics(2, 2, 0, 2));
}
@@ -191,14 +195,14 @@ static List getCategorizedEntitiesList1() {
CategorizedEntity categorizedEntity1 = new CategorizedEntity("trip", EntityCategory.EVENT, null, 0.0, 18, 4);
CategorizedEntity categorizedEntity2 = new CategorizedEntity("Seattle", EntityCategory.LOCATION, "GPE", 0.0, 26, 7);
CategorizedEntity categorizedEntity3 = new CategorizedEntity("last week", EntityCategory.DATE_TIME, "DateRange", 0.0, 34, 9);
- return Arrays.asList(categorizedEntity1, categorizedEntity2, categorizedEntity3);
+ return asList(categorizedEntity1, categorizedEntity2, categorizedEntity3);
}
/**
* Helper method to get the expected Categorized Entities List 2
*/
static List getCategorizedEntitiesList2() {
- return Arrays.asList(new CategorizedEntity("Microsoft", EntityCategory.ORGANIZATION, null, 0.0, 10, 9));
+ return asList(new CategorizedEntity("Microsoft", EntityCategory.ORGANIZATION, null, 0.0, 10, 9));
}
/**
@@ -233,7 +237,7 @@ static RecognizePiiEntitiesResultCollection getExpectedBatchPiiEntities() {
RecognizePiiEntitiesResult recognizeEntitiesResult2 = new RecognizePiiEntitiesResult("1", textDocumentStatistics2, null, piiEntityCollection2);
return new RecognizePiiEntitiesResultCollection(
- Arrays.asList(recognizeEntitiesResult1, recognizeEntitiesResult2),
+ asList(recognizeEntitiesResult1, recognizeEntitiesResult2),
DEFAULT_MODEL_VERSION,
new TextDocumentBatchStatistics(2, 2, 0, 2));
}
@@ -244,7 +248,7 @@ static RecognizePiiEntitiesResultCollection getExpectedBatchPiiEntities() {
static List getPiiEntitiesList1() {
PiiEntity piiEntity0 = new PiiEntity("Microsoft", EntityCategory.ORGANIZATION, null, 1.0, 0, 9);
PiiEntity piiEntity1 = new PiiEntity("859-98-0987", EntityCategory.fromString("U.S. Social Security Number (SSN)"), null, 0.65, 28, 11);
- return Arrays.asList(piiEntity0, piiEntity1);
+ return asList(piiEntity0, piiEntity1);
}
/**
@@ -255,7 +259,7 @@ static List getPiiEntitiesList2() {
PiiEntity piiEntity3 = new PiiEntity("111000025", EntityCategory.fromString("ABA Routing Number"), null, 0.75, 18, 9);
PiiEntity piiEntity4 = new PiiEntity("111000025", EntityCategory.fromString("New Zealand Social Welfare Number"), null, 0.65, 18, 9);
PiiEntity piiEntity5 = new PiiEntity("111000025", EntityCategory.fromString("Portugal Tax Identification Number"), null, 0.65, 18, 9);
- return Arrays.asList(piiEntity2, piiEntity3, piiEntity4, piiEntity5);
+ return asList(piiEntity2, piiEntity3, piiEntity4, piiEntity5);
}
/**
@@ -265,7 +269,7 @@ static List getPiiEntitiesList2() {
static RecognizeLinkedEntitiesResultCollection getExpectedBatchLinkedEntities() {
final TextDocumentBatchStatistics textDocumentBatchStatistics = new TextDocumentBatchStatistics(2, 2, 0, 2);
final List recognizeLinkedEntitiesResultList =
- Arrays.asList(
+ asList(
new RecognizeLinkedEntitiesResult(
"0", new TextDocumentStatistics(44, 1), null,
new LinkedEntityCollection(new IterableStream<>(getLinkedEntitiesList1()), null)),
@@ -284,7 +288,7 @@ static List getLinkedEntitiesList1() {
"Seattle", new IterableStream<>(Collections.singletonList(linkedEntityMatch)),
"en", "Seattle", "https://en.wikipedia.org/wiki/Seattle",
"Wikipedia");
- return Arrays.asList(linkedEntity);
+ return asList(linkedEntity);
}
/**
@@ -296,58 +300,89 @@ static List getLinkedEntitiesList2() {
"Microsoft", new IterableStream<>(Collections.singletonList(linkedEntityMatch)),
"en", "Microsoft", "https://en.wikipedia.org/wiki/Microsoft",
"Wikipedia");
- return Arrays.asList(linkedEntity);
+ return asList(linkedEntity);
}
/**
- * Helper method to get the expected Batch Key Phrases
- * @return
+ * Helper method to get the expected Batch Key Phrases.
*/
static ExtractKeyPhrasesResultCollection getExpectedBatchKeyPhrases() {
TextDocumentStatistics textDocumentStatistics1 = new TextDocumentStatistics(49, 1);
TextDocumentStatistics textDocumentStatistics2 = new TextDocumentStatistics(21, 1);
- ExtractKeyPhraseResult extractKeyPhraseResult1 = new ExtractKeyPhraseResult("0", textDocumentStatistics1, null, new KeyPhrasesCollection(new IterableStream<>(Arrays.asList("input text", "world")), null));
+ ExtractKeyPhraseResult extractKeyPhraseResult1 = new ExtractKeyPhraseResult("0", textDocumentStatistics1, null, new KeyPhrasesCollection(new IterableStream<>(asList("input text", "world")), null));
ExtractKeyPhraseResult extractKeyPhraseResult2 = new ExtractKeyPhraseResult("1", textDocumentStatistics2, null, new KeyPhrasesCollection(new IterableStream<>(Collections.singletonList("monde")), null));
TextDocumentBatchStatistics textDocumentBatchStatistics = new TextDocumentBatchStatistics(2, 2, 0, 2);
- List extractKeyPhraseResultList = Arrays.asList(extractKeyPhraseResult1, extractKeyPhraseResult2);
+ List extractKeyPhraseResultList = asList(extractKeyPhraseResult1, extractKeyPhraseResult2);
return new ExtractKeyPhrasesResultCollection(extractKeyPhraseResultList, DEFAULT_MODEL_VERSION, textDocumentBatchStatistics);
}
/**
* Helper method to get the expected Batch Text Sentiments
- * @return
*/
static AnalyzeSentimentResultCollection getExpectedBatchTextSentiment() {
final TextDocumentStatistics textDocumentStatistics = new TextDocumentStatistics(67, 1);
-
- final DocumentSentiment expectedDocumentSentiment = new DocumentSentiment(TextSentiment.MIXED,
- new SentimentConfidenceScores(0.0, 0.0, 0.0),
- new IterableStream<>(Arrays.asList(
- new SentenceSentiment("", TextSentiment.NEGATIVE, new SentimentConfidenceScores(0.0, 0.0, 0.0)),
- new SentenceSentiment("", TextSentiment.POSITIVE, new SentimentConfidenceScores(0.0, 0.0, 0.0))
- )), null);
-
- final DocumentSentiment expectedDocumentSentiment2 = new DocumentSentiment(TextSentiment.MIXED,
- new SentimentConfidenceScores(0.0, 0.0, 0.0),
- new IterableStream<>(Arrays.asList(
- new SentenceSentiment("", TextSentiment.POSITIVE, new SentimentConfidenceScores(0.0, 0.0, 0.0)),
- new SentenceSentiment("", TextSentiment.NEGATIVE, new SentimentConfidenceScores(0.0, 0.0, 0.0))
- )), null);
-
final AnalyzeSentimentResult analyzeSentimentResult1 = new AnalyzeSentimentResult("0",
- textDocumentStatistics, null, expectedDocumentSentiment);
-
+ textDocumentStatistics, null, getExpectedDocumentSentiment());
final AnalyzeSentimentResult analyzeSentimentResult2 = new AnalyzeSentimentResult("1",
- textDocumentStatistics, null, expectedDocumentSentiment2);
+ textDocumentStatistics, null, getExpectedDocumentSentiment2());
return new AnalyzeSentimentResultCollection(
- Arrays.asList(analyzeSentimentResult1, analyzeSentimentResult2),
+ asList(analyzeSentimentResult1, analyzeSentimentResult2),
DEFAULT_MODEL_VERSION, new TextDocumentBatchStatistics(2, 2, 0, 2));
}
+ /**
+ * Helper method that get the first expected DocumentSentiment result.
+ */
+ static DocumentSentiment getExpectedDocumentSentiment() {
+ return new DocumentSentiment(TextSentiment.MIXED,
+ new SentimentConfidenceScores(0.0, 0.0, 0.0),
+ new IterableStream<>(asList(
+ new SentenceSentiment("The hotel was dark and unclean.", TextSentiment.NEGATIVE,
+ new IterableStream<>(asList(new MinedOpinion(
+ new AspectSentiment("hotel", TextSentiment.NEGATIVE, 4, 5, new SentimentConfidenceScores(0.0, 0.0, 0.0)),
+ new IterableStream<>(asList(
+ new OpinionSentiment("dark", TextSentiment.NEGATIVE, 14, 4, false, new SentimentConfidenceScores(0.0, 0.0, 0.0)),
+ new OpinionSentiment("unclean", TextSentiment.NEGATIVE, 23, 7, false, new SentimentConfidenceScores(0.0, 0.0, 0.0))
+ ))))),
+ new SentimentConfidenceScores(0.0, 0.0, 0.0)),
+ new SentenceSentiment("The restaurant had amazing gnocchi.", TextSentiment.POSITIVE,
+ new IterableStream<>(asList(new MinedOpinion(
+ new AspectSentiment("gnocchi", TextSentiment.POSITIVE, 59, 7, new SentimentConfidenceScores(0.0, 0.0, 0.0)),
+ new IterableStream<>(asList(
+ new OpinionSentiment("amazing", TextSentiment.POSITIVE, 51, 7, false, new SentimentConfidenceScores(0.0, 0.0, 0.0))
+ ))))),
+ new SentimentConfidenceScores(0.0, 0.0, 0.0))
+ )), null);
+ }
+
+ /**
+ * Helper method that get the second expected DocumentSentiment result.
+ */
+ static DocumentSentiment getExpectedDocumentSentiment2() {
+ return new DocumentSentiment(TextSentiment.MIXED,
+ new SentimentConfidenceScores(0.0, 0.0, 0.0),
+ new IterableStream<>(asList(
+ new SentenceSentiment("The restaurant had amazing gnocchi.", TextSentiment.POSITIVE,
+ new IterableStream<>(asList(new MinedOpinion(
+ new AspectSentiment("gnocchi", TextSentiment.POSITIVE, 27, 7, new SentimentConfidenceScores(0.0, 0.0, 0.0)),
+ new IterableStream<>(asList(
+ new OpinionSentiment("amazing", TextSentiment.POSITIVE, 19, 7, false, new SentimentConfidenceScores(0.0, 0.0, 0.0))
+ ))))),
+ new SentimentConfidenceScores(0.0, 0.0, 0.0)),
+ new SentenceSentiment("The hotel was dark and unclean.", TextSentiment.NEGATIVE,
+ new IterableStream<>(asList(new MinedOpinion(
+ new AspectSentiment("hotel", TextSentiment.NEGATIVE, 40, 5, new SentimentConfidenceScores(0.0, 0.0, 0.0)),
+ new IterableStream<>(asList(
+ new OpinionSentiment("dark", TextSentiment.NEGATIVE, 50, 4, false, new SentimentConfidenceScores(0.0, 0.0, 0.0)),
+ new OpinionSentiment("unclean", TextSentiment.NEGATIVE, 59, 7, false, new SentimentConfidenceScores(0.0, 0.0, 0.0))
+ ))))),
+ new SentimentConfidenceScores(0.0, 0.0, 0.0))
+ )), null);
+ }
/**
* Returns a stream of arguments that includes all combinations of eligible {@link HttpClient HttpClients} and
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java
index e0eccd8773b68..6c04ff9158fc5 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsAsyncClientTest.java
@@ -3,11 +3,13 @@
package com.azure.ai.textanalytics;
+import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions;
import com.azure.ai.textanalytics.models.DocumentSentiment;
import com.azure.ai.textanalytics.models.SentenceSentiment;
import com.azure.ai.textanalytics.models.SentimentConfidenceScores;
import com.azure.ai.textanalytics.models.TextAnalyticsError;
import com.azure.ai.textanalytics.models.TextAnalyticsException;
+import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions;
import com.azure.ai.textanalytics.models.TextSentiment;
import com.azure.core.exception.HttpResponseException;
import com.azure.core.http.HttpClient;
@@ -32,6 +34,7 @@
import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchLinkedEntities;
import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchPiiEntities;
import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchTextSentiment;
+import static com.azure.ai.textanalytics.TestUtils.getExpectedDocumentSentiment;
import static com.azure.ai.textanalytics.TestUtils.getLinkedEntitiesList1;
import static com.azure.ai.textanalytics.TestUtils.getPiiEntitiesList1;
import static com.azure.ai.textanalytics.TestUtils.getUnknownDetectedLanguage;
@@ -794,16 +797,38 @@ public void extractKeyPhrasesBatchTooManyDocuments(HttpClient httpClient, TextAn
@MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
public void analyzeSentimentForTextInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsAsyncClient(httpClient, serviceVersion);
- final DocumentSentiment expectedDocumentSentiment = new DocumentSentiment(TextSentiment.MIXED,
- new SentimentConfidenceScores(0.0, 0.0, 0.0),
- new IterableStream<>(Arrays.asList(
- new SentenceSentiment("", TextSentiment.NEGATIVE, new SentimentConfidenceScores(0.0, 0.0, 0.0)),
- new SentenceSentiment("", TextSentiment.POSITIVE, new SentimentConfidenceScores(0.0, 0.0, 0.0))
- )), null);
+ analyzeSentimentForSingleTextInputRunner(input ->
+ StepVerifier.create(client.analyzeSentiment(input))
+ .assertNext(response -> validateAnalyzedSentiment(false, getExpectedDocumentSentiment(), response))
+ .verifyComplete()
+ );
+ }
- StepVerifier
- .create(client.analyzeSentiment("The hotel was dark and unclean. The restaurant had amazing gnocchi."))
- .assertNext(response -> validateAnalyzedSentiment(expectedDocumentSentiment, response)).verifyComplete();
+ /**
+ * Test analyzing sentiment for a string input with default language hint.
+ */
+ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
+ @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
+ public void analyzeSentimentForTextInputWithDefaultLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ client = getTextAnalyticsAsyncClient(httpClient, serviceVersion);
+ analyzeSentimentForSingleTextInputRunner(input ->
+ StepVerifier.create(client.analyzeSentiment(input, null))
+ .assertNext(response -> validateAnalyzedSentiment(false, getExpectedDocumentSentiment(), response))
+ .verifyComplete()
+ );
+ }
+
+ /**
+ * Test analyzing sentiment for a string input and verifying the result of opinion mining.
+ */
+ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
+ @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
+ public void analyzeSentimentForTextInputWithOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ client = getTextAnalyticsAsyncClient(httpClient, serviceVersion);
+ analyzeSentimentForTextInputWithOpinionMiningRunner((input, options) ->
+ StepVerifier.create(client.analyzeSentiment(input, "en", options))
+ .assertNext(response -> validateAnalyzedSentiment(true, getExpectedDocumentSentiment(), response))
+ .verifyComplete());
}
/**
@@ -813,10 +838,11 @@ public void analyzeSentimentForTextInput(HttpClient httpClient, TextAnalyticsSer
@MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
public void analyzeSentimentForEmptyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsAsyncClient(httpClient, serviceVersion);
- StepVerifier.create(client.analyzeSentiment(""))
- .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException
- && throwable.getMessage().equals(INVALID_DOCUMENT_EXPECTED_EXCEPTION_MESSAGE))
- .verify();
+ emptyTextRunner(input ->
+ StepVerifier.create(client.analyzeSentiment(input))
+ .expectErrorMatches(throwable -> throwable instanceof TextAnalyticsException
+ && INVALID_DOCUMENT_EXPECTED_EXCEPTION_MESSAGE.equals(throwable.getMessage()))
+ .verify());
}
/**
@@ -826,16 +852,18 @@ public void analyzeSentimentForEmptyText(HttpClient httpClient, TextAnalyticsSer
@MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
public void analyzeSentimentForFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsAsyncClient(httpClient, serviceVersion);
- final DocumentSentiment expectedDocumentSentiment = new DocumentSentiment(
- TextSentiment.NEUTRAL,
- new SentimentConfidenceScores(0.0, 0.0, 0.0),
- new IterableStream<>(Arrays.asList(
- new SentenceSentiment("", TextSentiment.NEUTRAL, new SentimentConfidenceScores(0.0, 0.0, 0.0)),
- new SentenceSentiment("", TextSentiment.NEUTRAL, new SentimentConfidenceScores(0.0, 0.0, 0.0))
- )), null);
-
- StepVerifier.create(client.analyzeSentiment("!@#%%"))
- .assertNext(response -> validateAnalyzedSentiment(expectedDocumentSentiment, response)).verifyComplete();
+ faultyTextRunner(input -> {
+ final DocumentSentiment expectedDocumentSentiment = new DocumentSentiment(
+ TextSentiment.NEUTRAL,
+ new SentimentConfidenceScores(0.0, 0.0, 0.0),
+ new IterableStream<>(Arrays.asList(
+ new SentenceSentiment("!", TextSentiment.NEUTRAL, null, new SentimentConfidenceScores(0.0, 0.0, 0.0)),
+ new SentenceSentiment("@#%%", TextSentiment.NEUTRAL, null, new SentimentConfidenceScores(0.0, 0.0, 0.0))
+ )), null);
+ StepVerifier.create(client.analyzeSentiment(input))
+ .assertNext(response -> validateAnalyzedSentiment(false, expectedDocumentSentiment, response))
+ .verifyComplete();
+ });
}
/**
@@ -846,7 +874,7 @@ public void analyzeSentimentForFaultyText(HttpClient httpClient, TextAnalyticsSe
public void analyzeSentimentDuplicateIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsAsyncClient(httpClient, serviceVersion);
analyzeBatchSentimentDuplicateIdRunner(inputs ->
- StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, null))
+ StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, new TextAnalyticsRequestOptions()))
.verifyErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass())));
}
@@ -870,67 +898,195 @@ public void analyzeSentimentEmptyIdInput(HttpClient httpClient, TextAnalyticsSer
}
/**
- * Test analyzing sentiment for a list of string input.
+ * Verify that the collection result excludes request statistics and mined options when given a batch of
+ * String documents with null TextAnalyticsRequestOptions and null language code which will use the default language
+ * code, 'en'.
+ *
+ * {@link TextAnalyticsAsyncClient#analyzeSentimentBatch(Iterable, String, TextAnalyticsRequestOptions)}
+ * which TextAnalyticsRequestOptions is null and null language code which will use the default language code, 'en'.
*/
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
public void analyzeSentimentForBatchStringInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsAsyncClient(httpClient, serviceVersion);
analyzeSentimentStringInputRunner(inputs ->
- StepVerifier.create(client.analyzeSentimentBatch(inputs, null, null))
- .assertNext(response -> validateSentimentResultCollection(false, getExpectedBatchTextSentiment(), response))
+ StepVerifier.create(client.analyzeSentimentBatch(inputs, null, new TextAnalyticsRequestOptions()))
+ .assertNext(response -> validateSentimentResultCollection(false, false, getExpectedBatchTextSentiment(), response))
.verifyComplete());
}
/**
- * Test analyzing sentiment for a list of string input with language code.
+ * Verify that the collection result excludes request statistics and mined options when given a batch of
+ * String documents with null TextAnalyticsRequestOptions and given a language code.
+ *
+ * {@link TextAnalyticsAsyncClient#analyzeSentimentBatch(Iterable, String, TextAnalyticsRequestOptions)}
+ * which TextAnalyticsRequestOptions is null and given a language code.
*/
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
- public void analyzeSentimentForListLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ public void analyzeSentimentForListStringWithLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsAsyncClient(httpClient, serviceVersion);
analyzeSentimentLanguageHintRunner((inputs, language) ->
- StepVerifier.create(client.analyzeSentimentBatch(inputs, language, null))
- .assertNext(response -> validateSentimentResultCollection(false, getExpectedBatchTextSentiment(), response))
+ StepVerifier.create(client.analyzeSentimentBatch(inputs, language, new TextAnalyticsRequestOptions()))
+ .assertNext(response -> validateSentimentResultCollection(false, false, getExpectedBatchTextSentiment(), response))
.verifyComplete());
}
/**
- * Test analyzing sentiment for a list of string input with request options.
+ * Verify that the collection result includes request statistics but not mined options when given a batch of
+ * String documents with AnalyzeSentimentOptions.
+ *
+ * {@link TextAnalyticsAsyncClient#analyzeSentimentBatch(Iterable, String, AnalyzeSentimentOptions)}
+ * which to show the request statistics only and verify the analyzed sentiment result.
*/
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
- public void analyzeSentimentForListStringWithOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ public void analyzeSentimentForListStringShowStatisticsExcludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsAsyncClient(httpClient, serviceVersion);
- analyzeBatchStringSentimentShowStatsRunner((inputs, options) ->
+ analyzeBatchStringSentimentShowStatsAndIncludeOpinionMiningRunner((inputs, options) ->
+ StepVerifier.create(client.analyzeSentimentBatch(inputs, null, options.setIncludeOpinionMining(false)))
+ .assertNext(response -> validateSentimentResultCollection(true, false, getExpectedBatchTextSentiment(), response))
+ .verifyComplete());
+ }
+
+ /**
+ * Verify that the collection result includes mined options but not request statistics when given a batch of
+ * String documents with AnalyzeSentimentOptions.
+ *
+ * {@link TextAnalyticsAsyncClient#analyzeSentimentBatch(Iterable, String, AnalyzeSentimentOptions)}
+ * which AnalyzeSentimentOptions includes opinion mining and request statistics.
+ */
+ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
+ @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
+ public void analyzeSentimentForListStringNotShowStatisticsButIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ client = getTextAnalyticsAsyncClient(httpClient, serviceVersion);
+ analyzeBatchStringSentimentShowStatsAndIncludeOpinionMiningRunner((inputs, options) -> {
+ options.setIncludeStatistics(false);
StepVerifier.create(client.analyzeSentimentBatch(inputs, null, options))
- .assertNext(response -> validateSentimentResultCollection(true, getExpectedBatchTextSentiment(), response))
+ .assertNext(response -> validateSentimentResultCollection(false, true, getExpectedBatchTextSentiment(), response))
+ .verifyComplete();
+ });
+ }
+
+ /**
+ * Verify that the collection result includes mined options and request statistics when given a batch of
+ * String documents with AnalyzeSentimentOptions.
+ *
+ * {@link TextAnalyticsAsyncClient#analyzeSentimentBatch(Iterable, String, AnalyzeSentimentOptions)}
+ * which AnalyzeSentimentOptions includes opinion mining and request statistics.
+ */
+ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
+ @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
+ public void analyzeSentimentForListStringShowStatisticsAndIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ client = getTextAnalyticsAsyncClient(httpClient, serviceVersion);
+ analyzeBatchStringSentimentShowStatsAndIncludeOpinionMiningRunner((inputs, options) ->
+ StepVerifier.create(client.analyzeSentimentBatch(inputs, null, options))
+ .assertNext(response -> validateSentimentResultCollection(true, true, getExpectedBatchTextSentiment(), response))
.verifyComplete());
}
/**
- * Test analyzing sentiment for a batch of documents.
+ * Verify that the collection result excludes request statistics and mined options when given a batch of
+ * TextDocumentInput documents with null TextAnalyticsRequestOptions.
+ *
+ * {@link TextAnalyticsAsyncClient#analyzeSentimentBatchWithResponse(Iterable, TextAnalyticsRequestOptions)}
+ * which TextAnalyticsRequestOptions is null.
*/
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
- public void analyzeSentimentForBatchInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ public void analyzeSentimentForBatchInputWithNullRequestOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsAsyncClient(httpClient, serviceVersion);
analyzeBatchSentimentRunner(inputs ->
- StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, null))
- .assertNext(response -> validateSentimentResultCollectionWithResponse(false, getExpectedBatchTextSentiment(), 200, response))
+ StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, (TextAnalyticsRequestOptions) null))
+ .assertNext(response -> validateSentimentResultCollectionWithResponse(false, false, getExpectedBatchTextSentiment(), 200, response))
.verifyComplete());
}
/**
- * Verify that we can get statistics on the collection result when given a batch of documents with options.
+ * Verify that we can get statistics on the collection result when given a batch of
+ * TextDocumentInput documents with TextAnalyticsRequestOptions.
+ *
+ * {@link TextAnalyticsAsyncClient#analyzeSentimentBatchWithResponse(Iterable, TextAnalyticsRequestOptions)}
+ * which TextAnalyticsRequestOptions includes request statistics.
*/
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
public void analyzeSentimentForBatchInputShowStatistics(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsAsyncClient(httpClient, serviceVersion);
- analyzeBatchSentimentShowStatsRunner((inputs, options) ->
+ analyzeBatchSentimentShowStatsRunner((inputs, requestOptions) ->
+ StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, requestOptions))
+ .assertNext(response -> validateSentimentResultCollectionWithResponse(true, false, getExpectedBatchTextSentiment(), 200, response))
+ .verifyComplete());
+ }
+
+ /**
+ * Verify that the collection result excludes request statistics and mined options when given a batch of
+ * TextDocumentInput documents with null AnalyzeSentimentOptions.
+ *
+ * {@link TextAnalyticsAsyncClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions)}
+ * which AnalyzeSentimentOptions is null.
+ */
+ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
+ @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
+ public void analyzeSentimentForBatchInputWithNullAnalyzeSentimentOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ client = getTextAnalyticsAsyncClient(httpClient, serviceVersion);
+ analyzeBatchSentimentOpinionMining((inputs, options) ->
+ StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, (AnalyzeSentimentOptions) null))
+ .assertNext(response -> validateSentimentResultCollectionWithResponse(false, false, getExpectedBatchTextSentiment(), 200, response))
+ .verifyComplete());
+ }
+
+ /**
+ * Verify that the collection result includes request statistics but not mined options when given a batch of
+ * TextDocumentInput documents with AnalyzeSentimentOptions.
+ *
+ * {@link TextAnalyticsAsyncClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions)}
+ * which AnalyzeSentimentOptions includes request statistics but not opinion mining.
+ */
+ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
+ @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
+ public void analyzeSentimentForBatchInputShowStatisticsExcludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ client = getTextAnalyticsAsyncClient(httpClient, serviceVersion);
+ analyzeBatchSentimentOpinionMining((inputs, options) ->
+ StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, options.setIncludeOpinionMining(false)))
+ .assertNext(response -> validateSentimentResultCollectionWithResponse(true, false, getExpectedBatchTextSentiment(), 200, response))
+ .verifyComplete());
+ }
+
+ /**
+ * Verify that the collection result includes mined options but not request statistics when given a batch of
+ * TextDocumentInput documents with AnalyzeSentimentOptions.
+ *
+ * {@link TextAnalyticsAsyncClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions)}
+ * which AnalyzeSentimentOptions includes opinion mining but not request statistics.
+ */
+ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
+ @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
+ public void analyzeSentimentForBatchInputNotShowStatisticsButIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ client = getTextAnalyticsAsyncClient(httpClient, serviceVersion);
+ analyzeBatchSentimentOpinionMining((inputs, options) -> {
+ options.setIncludeStatistics(false);
+ StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, options))
+ .assertNext(response ->
+ validateSentimentResultCollectionWithResponse(false, true, getExpectedBatchTextSentiment(), 200, response))
+ .verifyComplete();
+ });
+ }
+
+ /**
+ * Verify that the collection result includes mined options and request statistics when given a batch of
+ * TextDocumentInput documents with AnalyzeSentimentOptions.
+ *
+ * {@link TextAnalyticsAsyncClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions)}
+ * which AnalyzeSentimentOptions includes opinion mining and request statistics.
+ */
+ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
+ @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
+ public void analyzeSentimentForBatchInputShowStatisticsAndIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ client = getTextAnalyticsAsyncClient(httpClient, serviceVersion);
+ analyzeBatchSentimentOpinionMining((inputs, options) ->
StepVerifier.create(client.analyzeSentimentBatchWithResponse(inputs, options))
- .assertNext(response -> validateSentimentResultCollectionWithResponse(true, getExpectedBatchTextSentiment(), 200, response))
+ .assertNext(response -> validateSentimentResultCollectionWithResponse(true, true, getExpectedBatchTextSentiment(), 200, response))
.verifyComplete());
}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTest.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTest.java
index c797f2cf76ca9..fc573227a3423 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTest.java
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTest.java
@@ -3,6 +3,7 @@
package com.azure.ai.textanalytics;
+import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions;
import com.azure.ai.textanalytics.models.CategorizedEntity;
import com.azure.ai.textanalytics.models.DocumentSentiment;
import com.azure.ai.textanalytics.models.LinkedEntity;
@@ -11,6 +12,7 @@
import com.azure.ai.textanalytics.models.SentimentConfidenceScores;
import com.azure.ai.textanalytics.models.TextAnalyticsError;
import com.azure.ai.textanalytics.models.TextAnalyticsException;
+import com.azure.ai.textanalytics.models.TextAnalyticsRequestOptions;
import com.azure.ai.textanalytics.models.TextSentiment;
import com.azure.ai.textanalytics.util.RecognizeEntitiesResultCollection;
import com.azure.ai.textanalytics.util.RecognizePiiEntitiesResultCollection;
@@ -37,6 +39,7 @@
import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchLinkedEntities;
import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchPiiEntities;
import static com.azure.ai.textanalytics.TestUtils.getExpectedBatchTextSentiment;
+import static com.azure.ai.textanalytics.TestUtils.getExpectedDocumentSentiment;
import static com.azure.ai.textanalytics.TestUtils.getLinkedEntitiesList1;
import static com.azure.ai.textanalytics.TestUtils.getPiiEntitiesList1;
import static com.azure.ai.textanalytics.TestUtils.getUnknownDetectedLanguage;
@@ -299,7 +302,7 @@ public void recognizeEntitiesForBatchInput(HttpClient httpClient, TextAnalyticsS
public void recognizeEntitiesForBatchInputShowStatistics(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsClient(httpClient, serviceVersion);
recognizeBatchCategorizedEntitiesShowStatsRunner((inputs, options) ->
- validateCategorizedEntitiesResultCollectionWithResponse(false, getExpectedBatchCategorizedEntities(), 200,
+ validateCategorizedEntitiesResultCollectionWithResponse(true, getExpectedBatchCategorizedEntities(), 200,
client.recognizeEntitiesBatchWithResponse(inputs, options, Context.NONE))
);
}
@@ -328,7 +331,7 @@ public void recognizeEntitiesForListLanguageHint(HttpClient httpClient, TextAnal
public void recognizeEntitiesForListWithOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsClient(httpClient, serviceVersion);
recognizeStringBatchCategorizedEntitiesShowStatsRunner((inputs, options) ->
- validateCategorizedEntitiesResultCollection(false, getExpectedBatchCategorizedEntities(),
+ validateCategorizedEntitiesResultCollection(true, getExpectedBatchCategorizedEntities(),
client.recognizeEntitiesBatch(inputs, null, options))
);
}
@@ -730,17 +733,36 @@ public void extractKeyPhrasesBatchTooManyDocuments(HttpClient httpClient, TextAn
@MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
public void analyzeSentimentForTextInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsClient(httpClient, serviceVersion);
- final DocumentSentiment expectedDocumentSentiment = new DocumentSentiment(
- TextSentiment.MIXED,
- new SentimentConfidenceScores(0.0, 0.0, 0.0),
- new IterableStream<>(Arrays.asList(
- new SentenceSentiment("", TextSentiment.NEGATIVE, new SentimentConfidenceScores(0.0, 0.0, 0.0)),
- new SentenceSentiment("", TextSentiment.POSITIVE, new SentimentConfidenceScores(0.0, 0.0, 0.0))
- )), null);
- DocumentSentiment analyzeSentimentResult =
- client.analyzeSentiment("The hotel was dark and unclean. The restaurant had amazing gnocchi.");
+ analyzeSentimentForSingleTextInputRunner(input -> {
+ validateAnalyzedSentiment(false, getExpectedDocumentSentiment(), client.analyzeSentiment(input));
+ });
+ }
- validateAnalyzedSentiment(expectedDocumentSentiment, analyzeSentimentResult);
+ /**
+ * Test analyzing sentiment for a string input with default language hint.
+ */
+ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
+ @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
+ public void analyzeSentimentForTextInputWithDefaultLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ client = getTextAnalyticsClient(httpClient, serviceVersion);
+ analyzeSentimentForSingleTextInputRunner(input -> {
+ final DocumentSentiment analyzeSentimentResult = client.analyzeSentiment(input, null);
+ validateAnalyzedSentiment(false, getExpectedDocumentSentiment(), analyzeSentimentResult);
+ });
+ }
+
+ /**
+ * Test analyzing sentiment for a string input and verifying the result of opinion mining.
+ */
+ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
+ @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
+ public void analyzeSentimentForTextInputWithOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ client = getTextAnalyticsClient(httpClient, serviceVersion);
+ analyzeSentimentForTextInputWithOpinionMiningRunner((input, options) -> {
+ final DocumentSentiment analyzeSentimentResult =
+ client.analyzeSentiment(input, "en", options);
+ validateAnalyzedSentiment(true, getExpectedDocumentSentiment(), analyzeSentimentResult);
+ });
}
/**
@@ -750,8 +772,10 @@ public void analyzeSentimentForTextInput(HttpClient httpClient, TextAnalyticsSer
@MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
public void analyzeSentimentForEmptyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsClient(httpClient, serviceVersion);
- Exception exception = assertThrows(TextAnalyticsException.class, () -> client.analyzeSentiment(""));
- assertTrue(exception.getMessage().equals(INVALID_DOCUMENT_EXPECTED_EXCEPTION_MESSAGE));
+ emptyTextRunner(input -> {
+ final Exception exception = assertThrows(TextAnalyticsException.class, () -> client.analyzeSentiment(input));
+ assertEquals(INVALID_DOCUMENT_EXPECTED_EXCEPTION_MESSAGE, exception.getMessage());
+ });
}
/**
@@ -761,16 +785,16 @@ public void analyzeSentimentForEmptyText(HttpClient httpClient, TextAnalyticsSer
@MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
public void analyzeSentimentForFaultyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsClient(httpClient, serviceVersion);
- final DocumentSentiment expectedDocumentSentiment = new DocumentSentiment(TextSentiment.NEUTRAL,
- new SentimentConfidenceScores(0.0, 0.0, 0.0),
- new IterableStream<>(Arrays.asList(
- new SentenceSentiment("", TextSentiment.NEUTRAL, new SentimentConfidenceScores(0.0, 0.0, 0.0)),
- new SentenceSentiment("", TextSentiment.NEUTRAL, new SentimentConfidenceScores(0.0, 0.0, 0.0))
- )), null);
-
- DocumentSentiment analyzeSentimentResult = client.analyzeSentiment("!@#%%");
-
- validateAnalyzedSentiment(expectedDocumentSentiment, analyzeSentimentResult);
+ faultyTextRunner(input -> {
+ final DocumentSentiment expectedDocumentSentiment = new DocumentSentiment(
+ TextSentiment.NEUTRAL,
+ new SentimentConfidenceScores(0.0, 0.0, 0.0),
+ new IterableStream<>(Arrays.asList(
+ new SentenceSentiment("!", TextSentiment.NEUTRAL, null, new SentimentConfidenceScores(0.0, 0.0, 0.0)),
+ new SentenceSentiment("@#%%", TextSentiment.NEUTRAL, null, new SentimentConfidenceScores(0.0, 0.0, 0.0))
+ )), null);
+ validateAnalyzedSentiment(false, expectedDocumentSentiment, client.analyzeSentiment(input));
+ });
}
/**
@@ -782,7 +806,7 @@ public void analyzeSentimentDuplicateIdInput(HttpClient httpClient, TextAnalytic
client = getTextAnalyticsClient(httpClient, serviceVersion);
analyzeBatchSentimentDuplicateIdRunner(inputs -> {
HttpResponseException response = assertThrows(HttpResponseException.class,
- () -> client.analyzeSentimentBatchWithResponse(inputs, null, Context.NONE));
+ () -> client.analyzeSentimentBatchWithResponse(inputs, new TextAnalyticsRequestOptions(), Context.NONE));
assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, response.getResponse().getStatusCode());
});
}
@@ -806,62 +830,183 @@ public void analyzeSentimentEmptyIdInput(HttpClient httpClient, TextAnalyticsSer
}
/**
- * Test analyzing sentiment for a list of string input.
+ * Verify that the collection result excludes request statistics and mined options when given a batch of
+ * String documents with null TextAnalyticsRequestOptions and null language code which will use the default language
+ * code, 'en'.
+ *
+ * {@link TextAnalyticsClient#analyzeSentimentBatch(Iterable, String, TextAnalyticsRequestOptions)}
+ * which TextAnalyticsRequestOptions is null and null language code which will use the default language code, 'en'.
*/
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
public void analyzeSentimentForBatchStringInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsClient(httpClient, serviceVersion);
analyzeSentimentStringInputRunner(inputs ->
- validateSentimentResultCollection(false, getExpectedBatchTextSentiment(),
- client.analyzeSentimentBatch(inputs, null, null)));
+ validateSentimentResultCollection(false, false, getExpectedBatchTextSentiment(),
+ client.analyzeSentimentBatch(inputs, null, new TextAnalyticsRequestOptions())));
}
/**
- * Test analyzing sentiment for a list of string input with language code.
+ * Verify that the collection result excludes request statistics and mined options when given a batch of
+ * String documents with null TextAnalyticsRequestOptions and given a language code.
+ *
+ * {@link TextAnalyticsClient#analyzeSentimentBatch(Iterable, String, TextAnalyticsRequestOptions)}
+ * which TextAnalyticsRequestOptions is null and given a language code.
*/
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
- public void analyzeSentimentForListLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ public void analyzeSentimentForListStringWithLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsClient(httpClient, serviceVersion);
analyzeSentimentLanguageHintRunner((inputs, language) ->
- validateSentimentResultCollection(false, getExpectedBatchTextSentiment(),
- client.analyzeSentimentBatch(inputs, language, null)));
+ validateSentimentResultCollection(false, false, getExpectedBatchTextSentiment(),
+ client.analyzeSentimentBatch(inputs, language, new TextAnalyticsRequestOptions())));
+ }
+
+ /**
+ * Verify that the collection result includes request statistics but not mined options when given a batch of
+ * String documents with AnalyzeSentimentOptions.
+ *
+ * {@link TextAnalyticsClient#analyzeSentimentBatch(Iterable, String, AnalyzeSentimentOptions)}
+ * which to show the request statistics only and verify the analyzed sentiment result.
+ */
+ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
+ @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
+ public void analyzeSentimentForListStringShowStatisticsExcludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ client = getTextAnalyticsClient(httpClient, serviceVersion);
+ analyzeBatchStringSentimentShowStatsAndIncludeOpinionMiningRunner((inputs, options) ->
+ validateSentimentResultCollection(true, false, getExpectedBatchTextSentiment(),
+ client.analyzeSentimentBatch(inputs, null, options.setIncludeOpinionMining(false))));
+ }
+
+ /**
+ * Verify that the collection result includes mined options but not request statistics when given a batch of
+ * String documents with AnalyzeSentimentOptions.
+ *
+ * {@link TextAnalyticsClient#analyzeSentimentBatch(Iterable, String, AnalyzeSentimentOptions)}
+ * which AnalyzeSentimentOptions includes opinion mining and request statistics.
+ */
+ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
+ @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
+ public void analyzeSentimentForListStringNotShowStatisticsButIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ client = getTextAnalyticsClient(httpClient, serviceVersion);
+ analyzeBatchStringSentimentShowStatsAndIncludeOpinionMiningRunner((inputs, options) -> {
+ options.setIncludeStatistics(false);
+ validateSentimentResultCollection(false, true, getExpectedBatchTextSentiment(),
+ client.analyzeSentimentBatch(inputs, null, options));
+ });
}
/**
- * Verify that we can get statistics on the collection result when given a batch of documents with request options.
+ * Verify that the collection result includes mined options and request statistics when given a batch of
+ * String documents with AnalyzeSentimentOptions.
+ *
+ * {@link TextAnalyticsClient#analyzeSentimentBatch(Iterable, String, AnalyzeSentimentOptions)}
+ * which AnalyzeSentimentOptions includes opinion mining and request statistics.
*/
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
- public void analyzeSentimentForListStringWithOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ public void analyzeSentimentForListStringShowStatisticsAndIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsClient(httpClient, serviceVersion);
- analyzeBatchStringSentimentShowStatsRunner((inputs, options) ->
- validateSentimentResultCollection(true, getExpectedBatchTextSentiment(),
+ analyzeBatchStringSentimentShowStatsAndIncludeOpinionMiningRunner((inputs, options) ->
+ validateSentimentResultCollection(true, true, getExpectedBatchTextSentiment(),
client.analyzeSentimentBatch(inputs, null, options)));
}
/**
- * Test analyzing sentiment for batch of documents.
+ * Verify that the collection result excludes request statistics and mined options when given a batch of
+ * TextDocumentInput documents with null TextAnalyticsRequestOptions.
+ *
+ * {@link TextAnalyticsClient#analyzeSentimentBatchWithResponse(Iterable, TextAnalyticsRequestOptions, Context)}
+ * which TextAnalyticsRequestOptions is null.
*/
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
- public void analyzeSentimentForBatchInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ public void analyzeSentimentForBatchInputWithNullRequestOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsClient(httpClient, serviceVersion);
analyzeBatchSentimentRunner(inputs ->
- validateSentimentResultCollectionWithResponse(false, getExpectedBatchTextSentiment(), 200,
- client.analyzeSentimentBatchWithResponse(inputs, null, Context.NONE)));
+ validateSentimentResultCollectionWithResponse(false, false, getExpectedBatchTextSentiment(), 200,
+ client.analyzeSentimentBatchWithResponse(inputs, (TextAnalyticsRequestOptions) null, Context.NONE)));
}
/**
- * Verify that we can get statistics on the collection result when given a batch of documents with request options.
+ * Verify that we can get statistics on the collection result when given a batch of
+ * TextDocumentInput documents with TextAnalyticsRequestOptions.
+ *
+ * {@link TextAnalyticsClient#analyzeSentimentBatchWithResponse(Iterable, TextAnalyticsRequestOptions, Context)}
+ * which TextAnalyticsRequestOptions includes request statistics.
*/
@ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
@MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
public void analyzeSentimentForBatchInputShowStatistics(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
client = getTextAnalyticsClient(httpClient, serviceVersion);
- analyzeBatchSentimentShowStatsRunner((inputs, options) ->
- validateSentimentResultCollectionWithResponse(true, getExpectedBatchTextSentiment(), 200,
+ analyzeBatchSentimentShowStatsRunner((inputs, requestOptions) ->
+ validateSentimentResultCollectionWithResponse(true, false, getExpectedBatchTextSentiment(), 200,
+ client.analyzeSentimentBatchWithResponse(inputs, requestOptions, Context.NONE)));
+ }
+
+ /**
+ * Verify that the collection result excludes request statistics and mined options when given a batch of
+ * TextDocumentInput documents with null AnalyzeSentimentOptions.
+ *
+ * {@link TextAnalyticsClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions, Context)}
+ * which AnalyzeSentimentOptions is null.
+ */
+ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
+ @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
+ public void analyzeSentimentForBatchInputWithNullAnalyzeSentimentOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ client = getTextAnalyticsClient(httpClient, serviceVersion);
+ analyzeBatchSentimentOpinionMining((inputs, options) ->
+ validateSentimentResultCollectionWithResponse(false, false, getExpectedBatchTextSentiment(), 200,
+ client.analyzeSentimentBatchWithResponse(inputs, (AnalyzeSentimentOptions) null, Context.NONE)));
+ }
+
+ /**
+ * Verify that the collection result includes request statistics but not mined options when given a batch of
+ * TextDocumentInput documents with AnalyzeSentimentOptions.
+ *
+ * {@link TextAnalyticsClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions, Context)}
+ * which AnalyzeSentimentOptions includes request statistics but not opinion mining.
+ */
+ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
+ @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
+ public void analyzeSentimentForBatchInputShowStatisticsExcludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ client = getTextAnalyticsClient(httpClient, serviceVersion);
+ analyzeBatchSentimentOpinionMining((inputs, options) ->
+ validateSentimentResultCollectionWithResponse(true, false, getExpectedBatchTextSentiment(), 200,
+ client.analyzeSentimentBatchWithResponse(inputs, options.setIncludeOpinionMining(false), Context.NONE)));
+ }
+
+ /**
+ * Verify that the collection result includes mined options but not request statistics when given a batch of
+ * TextDocumentInput documents with AnalyzeSentimentOptions.
+ *
+ * {@link TextAnalyticsClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions, Context)}
+ * which AnalyzeSentimentOptions includes opinion mining but not request statistics.
+ */
+ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
+ @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
+ public void analyzeSentimentForBatchInputNotShowStatisticsButIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ client = getTextAnalyticsClient(httpClient, serviceVersion);
+ analyzeBatchSentimentOpinionMining((inputs, options) -> {
+ options.setIncludeStatistics(false);
+ validateSentimentResultCollectionWithResponse(false, true, getExpectedBatchTextSentiment(), 200,
+ client.analyzeSentimentBatchWithResponse(inputs, options, Context.NONE));
+ });
+ }
+
+ /**
+ * Verify that the collection result includes mined options and request statistics when given a batch of
+ * TextDocumentInput documents with AnalyzeSentimentOptions.
+ *
+ * {@link TextAnalyticsClient#analyzeSentimentBatchWithResponse(Iterable, AnalyzeSentimentOptions, Context)}
+ * which AnalyzeSentimentOptions includes opinion mining and request statistics.
+ */
+ @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS)
+ @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters")
+ public void analyzeSentimentForBatchInputShowStatisticsAndIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) {
+ client = getTextAnalyticsClient(httpClient, serviceVersion);
+ analyzeBatchSentimentOpinionMining((inputs, options) ->
+ validateSentimentResultCollectionWithResponse(true, true, getExpectedBatchTextSentiment(), 200,
client.analyzeSentimentBatchWithResponse(inputs, options, Context.NONE)));
}
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTestBase.java b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTestBase.java
index d4010ae03ac8c..8ae36b15d0b5b 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTestBase.java
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/java/com/azure/ai/textanalytics/TextAnalyticsClientTestBase.java
@@ -3,12 +3,16 @@
package com.azure.ai.textanalytics;
+import com.azure.ai.textanalytics.models.AnalyzeSentimentOptions;
+import com.azure.ai.textanalytics.models.AspectSentiment;
import com.azure.ai.textanalytics.models.CategorizedEntity;
import com.azure.ai.textanalytics.models.DetectLanguageInput;
import com.azure.ai.textanalytics.models.DetectedLanguage;
import com.azure.ai.textanalytics.models.DocumentSentiment;
import com.azure.ai.textanalytics.models.LinkedEntity;
import com.azure.ai.textanalytics.models.LinkedEntityMatch;
+import com.azure.ai.textanalytics.models.MinedOpinion;
+import com.azure.ai.textanalytics.models.OpinionSentiment;
import com.azure.ai.textanalytics.models.PiiEntity;
import com.azure.ai.textanalytics.models.SentenceSentiment;
import com.azure.ai.textanalytics.models.TextAnalyticsError;
@@ -220,6 +224,12 @@ public abstract class TextAnalyticsClientTestBase extends TestBase {
@Test
abstract void analyzeSentimentForTextInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
+ @Test
+ abstract void analyzeSentimentForTextInputWithDefaultLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
+
+ @Test
+ abstract void analyzeSentimentForTextInputWithOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
+
@Test
abstract void analyzeSentimentForEmptyText(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
@@ -233,16 +243,37 @@ public abstract class TextAnalyticsClientTestBase extends TestBase {
abstract void analyzeSentimentEmptyIdInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
@Test
- abstract void analyzeSentimentForBatchInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
+ abstract void analyzeSentimentForBatchStringInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
+
+ @Test
+ abstract void analyzeSentimentForListStringWithLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
+
+ @Test
+ abstract void analyzeSentimentForListStringShowStatisticsExcludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
+
+ @Test
+ abstract void analyzeSentimentForListStringNotShowStatisticsButIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
+
+ @Test
+ abstract void analyzeSentimentForListStringShowStatisticsAndIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
+
+ @Test
+ abstract void analyzeSentimentForBatchInputWithNullRequestOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
@Test
abstract void analyzeSentimentForBatchInputShowStatistics(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
@Test
- abstract void analyzeSentimentForBatchStringInput(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
+ abstract void analyzeSentimentForBatchInputWithNullAnalyzeSentimentOptions(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
+
+ @Test
+ abstract void analyzeSentimentForBatchInputShowStatisticsExcludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
+
+ @Test
+ abstract void analyzeSentimentForBatchInputNotShowStatisticsButIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
@Test
- abstract void analyzeSentimentForListLanguageHint(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
+ abstract void analyzeSentimentForBatchInputShowStatisticsAndIncludeOpinionMining(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
@Test
abstract void analyzeSentimentBatchTooManyDocuments(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion);
@@ -447,6 +478,14 @@ void extractKeyPhrasesBatchWarningRunner(Consumer> testR
}
// Sentiment Runner
+ void analyzeSentimentForSingleTextInputRunner(Consumer testRunner) {
+ testRunner.accept(SENTIMENT_INPUTS.get(0));
+ }
+
+ void analyzeSentimentForTextInputWithOpinionMiningRunner(BiConsumer testRunner) {
+ testRunner.accept(SENTIMENT_INPUTS.get(0), new AnalyzeSentimentOptions().setIncludeOpinionMining(true));
+ }
+
void analyzeSentimentLanguageHintRunner(BiConsumer, String> testRunner) {
testRunner.accept(SENTIMENT_INPUTS, "en");
}
@@ -463,16 +502,20 @@ void analyzeBatchSentimentDuplicateIdRunner(Consumer> te
testRunner.accept(getDuplicateTextDocumentInputs());
}
- void analyzeBatchStringSentimentShowStatsRunner(BiConsumer, TextAnalyticsRequestOptions> testRunner) {
- testRunner.accept(SENTIMENT_INPUTS, new TextAnalyticsRequestOptions().setIncludeStatistics(true));
+ void analyzeBatchStringSentimentShowStatsAndIncludeOpinionMiningRunner(BiConsumer, AnalyzeSentimentOptions> testRunner) {
+ testRunner.accept(SENTIMENT_INPUTS,
+ new AnalyzeSentimentOptions().setIncludeStatistics(true).setIncludeOpinionMining(true));
}
- void analyzeBatchSentimentShowStatsRunner(
- BiConsumer, TextAnalyticsRequestOptions> testRunner) {
+ void analyzeBatchSentimentShowStatsRunner(BiConsumer, TextAnalyticsRequestOptions> testRunner) {
final List textDocumentInputs = TestUtils.getTextDocumentInputs(SENTIMENT_INPUTS);
+ testRunner.accept(textDocumentInputs, new TextAnalyticsRequestOptions().setIncludeStatistics(true));
+ }
- TextAnalyticsRequestOptions options = new TextAnalyticsRequestOptions().setIncludeStatistics(true);
- testRunner.accept(textDocumentInputs, options);
+ void analyzeBatchSentimentOpinionMining(BiConsumer, AnalyzeSentimentOptions> testRunner) {
+ final List textDocumentInputs = TestUtils.getTextDocumentInputs(SENTIMENT_INPUTS);
+ testRunner.accept(textDocumentInputs, new AnalyzeSentimentOptions().setIncludeOpinionMining(true)
+ .setIncludeStatistics(true));
}
// other Runners
@@ -603,18 +646,18 @@ static void validateExtractKeyPhrasesResultCollection(boolean showStatistics,
actualItem.getKeyPhrases().stream().collect(Collectors.toList())));
}
- static void validateSentimentResultCollectionWithResponse(boolean showStatistics,
- AnalyzeSentimentResultCollection expected, int expectedStatusCode,
- Response response) {
+ static void validateSentimentResultCollectionWithResponse(boolean showStatistics, boolean includeOpinionMining,
+ AnalyzeSentimentResultCollection expected,
+ int expectedStatusCode, Response response) {
assertNotNull(response);
assertEquals(expectedStatusCode, response.getStatusCode());
- validateSentimentResultCollection(showStatistics, expected, response.getValue());
+ validateSentimentResultCollection(showStatistics, includeOpinionMining, expected, response.getValue());
}
- static void validateSentimentResultCollection(boolean showStatistics,
+ static void validateSentimentResultCollection(boolean showStatistics, boolean includeOpinionMining,
AnalyzeSentimentResultCollection expected, AnalyzeSentimentResultCollection actual) {
validateTextAnalyticsResult(showStatistics, expected, actual, (expectedItem, actualItem) ->
- validateAnalyzedSentiment(expectedItem.getDocumentSentiment(), actualItem.getDocumentSentiment()));
+ validateAnalyzedSentiment(includeOpinionMining, expectedItem.getDocumentSentiment(), actualItem.getDocumentSentiment()));
}
/**
@@ -755,12 +798,12 @@ static void validateLinkedEntities(List expectedLinkedEntityList,
* @param expectedSentimentList a list of analyzed sentence sentiment returned by the service.
* @param actualSentimentList a list of analyzed sentence sentiment returned by the API.
*/
- static void validateAnalyzedSentenceSentiment(List expectedSentimentList,
+ static void validateAnalyzedSentenceSentiment(boolean includeOpinionMining, List expectedSentimentList,
List actualSentimentList) {
assertEquals(expectedSentimentList.size(), actualSentimentList.size());
for (int i = 0; i < expectedSentimentList.size(); i++) {
- validateSentenceSentiment(expectedSentimentList.get(i), actualSentimentList.get(i));
+ validateSentenceSentiment(includeOpinionMining, expectedSentimentList.get(i), actualSentimentList.get(i));
}
}
@@ -771,8 +814,73 @@ static void validateAnalyzedSentenceSentiment(List expectedSe
* @param expectedSentiment analyzed sentence sentiment returned by the service.
* @param actualSentiment analyzed sentence sentiment returned by the API.
*/
- static void validateSentenceSentiment(SentenceSentiment expectedSentiment, SentenceSentiment actualSentiment) {
+ static void validateSentenceSentiment(boolean includeOpinionMining, SentenceSentiment expectedSentiment, SentenceSentiment actualSentiment) {
assertEquals(expectedSentiment.getSentiment(), actualSentiment.getSentiment());
+ assertEquals(expectedSentiment.getText(), actualSentiment.getText());
+ if (includeOpinionMining) {
+ validateSentenceMinedOpinions(expectedSentiment.getMinedOpinions().stream().collect(Collectors.toList()),
+ actualSentiment.getMinedOpinions().stream().collect(Collectors.toList()));
+ } else {
+ assertNull(actualSentiment.getMinedOpinions());
+ }
+ }
+
+ /**
+ * Helper method to validate sentence's mined opinions.
+ *
+ * @param expectedMinedOpinions a list of mined opinions returned by the service.
+ * @param actualMinedOpinions a list of mined opinions returned by the API.
+ */
+ static void validateSentenceMinedOpinions(List expectedMinedOpinions,
+ List actualMinedOpinions) {
+ assertEquals(expectedMinedOpinions.size(), actualMinedOpinions.size());
+ for (int i = 0; i < actualMinedOpinions.size(); i++) {
+ final MinedOpinion expectedMinedOpinion = expectedMinedOpinions.get(i);
+ final MinedOpinion actualMinedOpinion = actualMinedOpinions.get(i);
+ validateAspectSentiment(expectedMinedOpinion.getAspect(), actualMinedOpinion.getAspect());
+ validateAspectOpinionList(expectedMinedOpinion.getOpinions().stream().collect(Collectors.toList()),
+ actualMinedOpinion.getOpinions().stream().collect(Collectors.toList()));
+ }
+ }
+
+ /**
+ * Helper method to validate aspect sentiment.
+ *
+ * @param expectedAspectSentiment An expected aspect sentiment.
+ * @param actualAspectSentiment An actual aspect sentiment.
+ */
+ static void validateAspectSentiment(AspectSentiment expectedAspectSentiment, AspectSentiment actualAspectSentiment) {
+ assertEquals(expectedAspectSentiment.getSentiment(), actualAspectSentiment.getSentiment());
+ assertEquals(expectedAspectSentiment.getText(), actualAspectSentiment.getText());
+ assertEquals(expectedAspectSentiment.getLength(), actualAspectSentiment.getLength());
+ assertEquals(expectedAspectSentiment.getOffset(), actualAspectSentiment.getOffset());
+ }
+
+ /**
+ * Helper method to validate a list of {@link OpinionSentiment}.
+ *
+ * @param expectedOpinionSentiments A list of expected opinion sentiments.
+ * @param actualOpinionSentiments A list of actual opinion sentiments.
+ */
+ static void validateAspectOpinionList(List expectedOpinionSentiments, List actualOpinionSentiments) {
+ assertEquals(expectedOpinionSentiments.size(), actualOpinionSentiments.size());
+ for (int i = 0; i < expectedOpinionSentiments.size(); i++) {
+ validateAspectOpinion(expectedOpinionSentiments.get(i), actualOpinionSentiments.get(i));
+ }
+ }
+
+ /**
+ * Helper method to validate opinion sentiment.
+ *
+ * @param expectedAspectOpinion An expected opinion sentiment.
+ * @param actualAspectOpinion An actual opinion sentiment.
+ */
+ static void validateAspectOpinion(OpinionSentiment expectedAspectOpinion, OpinionSentiment actualAspectOpinion) {
+ assertEquals(expectedAspectOpinion.getSentiment(), actualAspectOpinion.getSentiment());
+ assertEquals(expectedAspectOpinion.getText(), actualAspectOpinion.getText());
+ assertEquals(expectedAspectOpinion.isNegated(), actualAspectOpinion.isNegated());
+ assertEquals(expectedAspectOpinion.getLength(), actualAspectOpinion.getLength());
+ assertEquals(expectedAspectOpinion.getOffset(), actualAspectOpinion.getOffset());
}
/**
@@ -782,10 +890,12 @@ static void validateSentenceSentiment(SentenceSentiment expectedSentiment, Sente
* @param expectedSentiment analyzed document sentiment returned by the service.
* @param actualSentiment analyzed document sentiment returned by the API.
*/
- static void validateAnalyzedSentiment(DocumentSentiment expectedSentiment, DocumentSentiment actualSentiment) {
+ static void validateAnalyzedSentiment(boolean includeOpinionMining, DocumentSentiment expectedSentiment,
+ DocumentSentiment actualSentiment) {
assertEquals(expectedSentiment.getSentiment(), actualSentiment.getSentiment());
- validateAnalyzedSentenceSentiment(expectedSentiment.getSentences().stream().collect(Collectors.toList()),
- expectedSentiment.getSentences().stream().collect(Collectors.toList()));
+ validateAnalyzedSentenceSentiment(includeOpinionMining,
+ expectedSentiment.getSentences().stream().collect(Collectors.toList()),
+ actualSentiment.getSentences().stream().collect(Collectors.toList()));
}
/**
@@ -818,6 +928,18 @@ static > void validat
validateBatchStatistics(((RecognizeLinkedEntitiesResultCollection) expectedResults).getStatistics(),
((RecognizeLinkedEntitiesResultCollection) actualResults).getStatistics());
}
+ } else {
+ if (expectedResults instanceof AnalyzeSentimentResultCollection) {
+ assertNull(((AnalyzeSentimentResultCollection) actualResults).getStatistics());
+ } else if (expectedResults instanceof DetectLanguageResultCollection) {
+ assertNull(((DetectLanguageResultCollection) actualResults).getStatistics());
+ } else if (expectedResults instanceof ExtractKeyPhrasesResultCollection) {
+ assertNull(((ExtractKeyPhrasesResultCollection) actualResults).getStatistics());
+ } else if (expectedResults instanceof RecognizeEntitiesResultCollection) {
+ assertNull(((RecognizeEntitiesResultCollection) actualResults).getStatistics());
+ } else if (expectedResults instanceof RecognizeLinkedEntitiesResultCollection) {
+ assertNull(((RecognizeLinkedEntitiesResultCollection) actualResults).getStatistics());
+ }
}
expected.forEach((key, expectedValue) -> {
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker
new file mode 100644
index 0000000000000..1f0955d450f0d
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker
@@ -0,0 +1 @@
+mock-maker-inline
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentDuplicateIdInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentDuplicateIdInput.json
index c9d5ef0d29908..72b446e011c36 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentDuplicateIdInput.json
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentDuplicateIdInput.json
@@ -1,22 +1,22 @@
{
"networkCallRecords" : [ {
"Method" : "POST",
- "Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment",
+ "Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment?showStats=false&opinionMining=false",
"Headers" : {
- "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
- "x-ms-client-request-id" : "35eb8773-e999-4513-8d99-2be40442eefa",
+ "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "b71587d2-92a0-4801-884a-9b64e465b52b",
"Content-Type" : "application/json"
},
"Response" : {
"Transfer-Encoding" : "chunked",
- "x-envoy-upstream-service-time" : "4",
+ "x-envoy-upstream-service-time" : "857",
"Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
"x-content-type-options" : "nosniff",
- "apim-request-id" : "03e3f07a-e90c-4caf-8e74-fb8216119043",
+ "apim-request-id" : "a649d200-61d3-4ff8-8ccb-ec9bd374a17a",
"retry-after" : "0",
"StatusCode" : "400",
"Body" : "{\"error\":{\"code\":\"InvalidRequest\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Request contains duplicated Ids. Make sure each document has a unique Id.\"}}}",
- "Date" : "Wed, 15 Jul 2020 04:14:29 GMT",
+ "Date" : "Wed, 19 Aug 2020 12:12:26 GMT",
"Content-Type" : "application/json; charset=utf-8"
},
"Exception" : null
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputNotShowStatisticsButIncludeOpinionMining.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputNotShowStatisticsButIncludeOpinionMining.json
new file mode 100644
index 0000000000000..4da14aee95d0d
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputNotShowStatisticsButIncludeOpinionMining.json
@@ -0,0 +1,26 @@
+{
+ "networkCallRecords" : [ {
+ "Method" : "POST",
+ "Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment?showStats=false&opinionMining=true",
+ "Headers" : {
+ "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "cba40f81-c586-4ca0-bc21-0007e532435c",
+ "Content-Type" : "application/json"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-envoy-upstream-service-time" : "1020",
+ "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
+ "x-content-type-options" : "nosniff",
+ "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2",
+ "apim-request-id" : "23360b86-499e-4fb4-a0bf-feae50c53e13",
+ "retry-after" : "0",
+ "StatusCode" : "200",
+ "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\",\"aspects\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":4,\"length\":5,\"text\":\"hotel\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/0\"},{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/1\"}]}],\"opinions\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":14,\"length\":4,\"text\":\"dark\",\"isNegated\":false},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":23,\"length\":7,\"text\":\"unclean\",\"isNegated\":false}]},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\",\"aspects\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":59,\"length\":7,\"text\":\"gnocchi\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/1/opinions/0\"}]}],\"opinions\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":51,\"length\":7,\"text\":\"amazing\",\"isNegated\":false}]}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\",\"aspects\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":27,\"length\":7,\"text\":\"gnocchi\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/0/opinions/0\"}]}],\"opinions\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":19,\"length\":7,\"text\":\"amazing\",\"isNegated\":false}]},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\",\"aspects\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":40,\"length\":5,\"text\":\"hotel\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/1/opinions/0\"},{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/1/opinions/1\"}]}],\"opinions\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":50,\"length\":4,\"text\":\"dark\",\"isNegated\":false},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":59,\"length\":7,\"text\":\"unclean\",\"isNegated\":false}]}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}",
+ "Date" : "Thu, 13 Aug 2020 02:46:06 GMT",
+ "Content-Type" : "application/json; charset=utf-8"
+ },
+ "Exception" : null
+ } ],
+ "variables" : [ ]
+}
\ No newline at end of file
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatistics.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatistics.json
index d743331018666..bb6b021cb8c1d 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatistics.json
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatistics.json
@@ -1,23 +1,23 @@
{
"networkCallRecords" : [ {
"Method" : "POST",
- "Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment?showStats=true",
+ "Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment?showStats=true&opinionMining=false",
"Headers" : {
- "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
- "x-ms-client-request-id" : "cee9a1c2-b321-4ac5-8081-d779b9fe17f9",
+ "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "d9bf8c67-2dfe-47b6-8910-6a5f45fd4632",
"Content-Type" : "application/json"
},
"Response" : {
"Transfer-Encoding" : "chunked",
- "x-envoy-upstream-service-time" : "85",
+ "x-envoy-upstream-service-time" : "977",
"Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
"x-content-type-options" : "nosniff",
"csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2",
- "apim-request-id" : "427cc017-f2bc-42f0-bda4-aa1c305be30c",
+ "apim-request-id" : "b729dbe2-af27-4322-bc97-70ed6d3c86ac",
"retry-after" : "0",
"StatusCode" : "200",
"Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}",
- "Date" : "Wed, 15 Jul 2020 04:14:39 GMT",
+ "Date" : "Thu, 13 Aug 2020 02:46:52 GMT",
"Content-Type" : "application/json; charset=utf-8"
},
"Exception" : null
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatisticsAndIncludeOpinionMining.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatisticsAndIncludeOpinionMining.json
new file mode 100644
index 0000000000000..104c9f999beb0
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatisticsAndIncludeOpinionMining.json
@@ -0,0 +1,26 @@
+{
+ "networkCallRecords" : [ {
+ "Method" : "POST",
+ "Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment?showStats=true&opinionMining=true",
+ "Headers" : {
+ "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "ee7044d2-8e5d-4dbf-88a3-743ca60094e7",
+ "Content-Type" : "application/json"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-envoy-upstream-service-time" : "932",
+ "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
+ "x-content-type-options" : "nosniff",
+ "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2",
+ "apim-request-id" : "d81a7648-08c6-4e81-b3a5-7356d12ab8e5",
+ "retry-after" : "0",
+ "StatusCode" : "200",
+ "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\",\"aspects\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":4,\"length\":5,\"text\":\"hotel\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/0\"},{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/1\"}]}],\"opinions\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":14,\"length\":4,\"text\":\"dark\",\"isNegated\":false},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":23,\"length\":7,\"text\":\"unclean\",\"isNegated\":false}]},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\",\"aspects\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":59,\"length\":7,\"text\":\"gnocchi\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/1/opinions/0\"}]}],\"opinions\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":51,\"length\":7,\"text\":\"amazing\",\"isNegated\":false}]}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\",\"aspects\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":27,\"length\":7,\"text\":\"gnocchi\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/0/opinions/0\"}]}],\"opinions\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":19,\"length\":7,\"text\":\"amazing\",\"isNegated\":false}]},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\",\"aspects\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":40,\"length\":5,\"text\":\"hotel\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/1/opinions/0\"},{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/1/opinions/1\"}]}],\"opinions\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":50,\"length\":4,\"text\":\"dark\",\"isNegated\":false},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":59,\"length\":7,\"text\":\"unclean\",\"isNegated\":false}]}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}",
+ "Date" : "Thu, 13 Aug 2020 02:45:54 GMT",
+ "Content-Type" : "application/json; charset=utf-8"
+ },
+ "Exception" : null
+ } ],
+ "variables" : [ ]
+}
\ No newline at end of file
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringWithOptions.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatisticsExcludeOpinionMining.json
similarity index 84%
rename from sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringWithOptions.json
rename to sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatisticsExcludeOpinionMining.json
index 1c0b90702e698..efe062136f68f 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringWithOptions.json
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputShowStatisticsExcludeOpinionMining.json
@@ -1,23 +1,23 @@
{
"networkCallRecords" : [ {
"Method" : "POST",
- "Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment?showStats=true",
+ "Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment?showStats=true&opinionMining=false",
"Headers" : {
- "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
- "x-ms-client-request-id" : "b05cb28f-b425-48ab-8e47-caacf51b806d",
+ "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "31d48485-0b64-435e-bf39-49cbd7c0207e",
"Content-Type" : "application/json"
},
"Response" : {
"Transfer-Encoding" : "chunked",
- "x-envoy-upstream-service-time" : "106",
+ "x-envoy-upstream-service-time" : "974",
"Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
"x-content-type-options" : "nosniff",
"csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2",
- "apim-request-id" : "767af6d1-b389-4453-9aa7-064af57d0f1c",
+ "apim-request-id" : "89aa233a-0cb5-404c-88cb-56563de55f30",
"retry-after" : "0",
"StatusCode" : "200",
"Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}",
- "Date" : "Wed, 15 Jul 2020 04:14:38 GMT",
+ "Date" : "Thu, 13 Aug 2020 02:45:46 GMT",
"Content-Type" : "application/json; charset=utf-8"
},
"Exception" : null
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputWithNullAnalyzeSentimentOptions.json
similarity index 85%
rename from sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInput.json
rename to sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputWithNullAnalyzeSentimentOptions.json
index f6e6cb2e01910..b358a63fe8071 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInput.json
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputWithNullAnalyzeSentimentOptions.json
@@ -3,21 +3,21 @@
"Method" : "POST",
"Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment",
"Headers" : {
- "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
- "x-ms-client-request-id" : "9b455e87-cc48-44f2-bd68-d1707c29fa34",
+ "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "72540f78-b82a-4a7b-9681-384941cc781b",
"Content-Type" : "application/json"
},
"Response" : {
"Transfer-Encoding" : "chunked",
- "x-envoy-upstream-service-time" : "91",
+ "x-envoy-upstream-service-time" : "427",
"Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
"x-content-type-options" : "nosniff",
"csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2",
- "apim-request-id" : "ca2e5376-b597-446c-8ec3-cda901902bd0",
+ "apim-request-id" : "4ba8643d-1a3c-4f9e-b0c4-de195ff1430a",
"retry-after" : "0",
"StatusCode" : "200",
"Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}",
- "Date" : "Wed, 15 Jul 2020 04:14:32 GMT",
+ "Date" : "Wed, 19 Aug 2020 12:16:42 GMT",
"Content-Type" : "application/json; charset=utf-8"
},
"Exception" : null
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListLanguageHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputWithNullRequestOptions.json
similarity index 82%
rename from sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListLanguageHint.json
rename to sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputWithNullRequestOptions.json
index d44c0e87b37a6..593ff1708b19d 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListLanguageHint.json
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchInputWithNullRequestOptions.json
@@ -1,23 +1,23 @@
{
"networkCallRecords" : [ {
"Method" : "POST",
- "Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment",
+ "Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment?showStats=false&opinionMining=false",
"Headers" : {
- "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
- "x-ms-client-request-id" : "bfacc9cd-d097-40bd-84cb-e4a7d639641e",
+ "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "8cc2f855-9ea4-48fc-b48c-721a37cb932b",
"Content-Type" : "application/json"
},
"Response" : {
"Transfer-Encoding" : "chunked",
- "x-envoy-upstream-service-time" : "145",
+ "x-envoy-upstream-service-time" : "483",
"Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
"x-content-type-options" : "nosniff",
"csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2",
- "apim-request-id" : "af1778a3-0d86-4f67-a583-becbc1bf24e8",
+ "apim-request-id" : "7fff84fa-4c3b-4999-a8e2-e5407f83f591",
"retry-after" : "0",
"StatusCode" : "200",
"Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}",
- "Date" : "Wed, 15 Jul 2020 04:14:32 GMT",
+ "Date" : "Wed, 19 Aug 2020 12:16:02 GMT",
"Content-Type" : "application/json; charset=utf-8"
},
"Exception" : null
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchStringInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchStringInput.json
index b0dbe661191fa..5c0c67fcd1c2e 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchStringInput.json
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForBatchStringInput.json
@@ -1,23 +1,23 @@
{
"networkCallRecords" : [ {
"Method" : "POST",
- "Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment",
+ "Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment?showStats=false&opinionMining=false",
"Headers" : {
- "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
- "x-ms-client-request-id" : "6a149fed-28e9-4051-92b5-ce68098984a3",
+ "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "3d4b440a-b534-4c2a-9d54-a36ba0c01c93",
"Content-Type" : "application/json"
},
"Response" : {
"Transfer-Encoding" : "chunked",
- "x-envoy-upstream-service-time" : "112",
+ "x-envoy-upstream-service-time" : "1414",
"Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
"x-content-type-options" : "nosniff",
"csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2",
- "apim-request-id" : "58d21046-7255-4c36-b95a-d73489a85088",
+ "apim-request-id" : "642f692e-b950-4196-9626-72e0471c8fb6",
"retry-after" : "0",
"StatusCode" : "200",
"Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}",
- "Date" : "Wed, 15 Jul 2020 04:14:33 GMT",
+ "Date" : "Wed, 19 Aug 2020 12:12:57 GMT",
"Content-Type" : "application/json; charset=utf-8"
},
"Exception" : null
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForEmptyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForEmptyText.json
index e9a4adbda0652..b87369d64e14d 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForEmptyText.json
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForEmptyText.json
@@ -3,20 +3,20 @@
"Method" : "POST",
"Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment",
"Headers" : {
- "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
- "x-ms-client-request-id" : "f67f970f-c761-4c83-a20e-083e7a6ae6f1",
+ "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "b3847ede-f44a-4b9e-ac28-244e1a1f6b5a",
"Content-Type" : "application/json"
},
"Response" : {
"Transfer-Encoding" : "chunked",
- "x-envoy-upstream-service-time" : "283",
+ "x-envoy-upstream-service-time" : "885",
"Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
"x-content-type-options" : "nosniff",
- "apim-request-id" : "2a27fe98-5923-47bf-83c7-22091d7fd4b6",
+ "apim-request-id" : "1c05f21f-1ba9-4576-bb26-4fee089fe844",
"retry-after" : "0",
"StatusCode" : "200",
"Body" : "{\"documents\":[],\"errors\":[{\"id\":\"0\",\"error\":{\"code\":\"InvalidArgument\",\"message\":\"Invalid document in request.\",\"innererror\":{\"code\":\"InvalidDocument\",\"message\":\"Document text is empty.\"}}}],\"modelVersion\":\"2020-04-01\"}",
- "Date" : "Wed, 15 Jul 2020 06:20:06 GMT",
+ "Date" : "Wed, 19 Aug 2020 12:06:48 GMT",
"Content-Type" : "application/json; charset=utf-8"
},
"Exception" : null
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForFaultyText.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForFaultyText.json
index 7c961368f5869..5616a8b50b0a9 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForFaultyText.json
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForFaultyText.json
@@ -3,21 +3,21 @@
"Method" : "POST",
"Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment",
"Headers" : {
- "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
- "x-ms-client-request-id" : "314fc550-6a3e-4b08-b0eb-6a78f5c43a7d",
+ "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "00c290e3-841e-41e8-bd05-6b34bda8a5be",
"Content-Type" : "application/json"
},
"Response" : {
"Transfer-Encoding" : "chunked",
- "x-envoy-upstream-service-time" : "95",
+ "x-envoy-upstream-service-time" : "1109",
"Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
"x-content-type-options" : "nosniff",
"csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1",
- "apim-request-id" : "80d8febf-8794-4f72-a306-103a88fb9088",
+ "apim-request-id" : "14908804-a749-42f8-a444-8ec4c5c47ced",
"retry-after" : "0",
"StatusCode" : "200",
"Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"neutral\",\"confidenceScores\":{\"positive\":0.06,\"neutral\":0.91,\"negative\":0.03},\"sentences\":[{\"sentiment\":\"neutral\",\"confidenceScores\":{\"positive\":0.06,\"neutral\":0.91,\"negative\":0.03},\"offset\":0,\"length\":1,\"text\":\"!\"},{\"sentiment\":\"neutral\",\"confidenceScores\":{\"positive\":0.06,\"neutral\":0.91,\"negative\":0.03},\"offset\":1,\"length\":4,\"text\":\"@#%%\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}",
- "Date" : "Wed, 15 Jul 2020 04:14:36 GMT",
+ "Date" : "Wed, 19 Aug 2020 12:11:47 GMT",
"Content-Type" : "application/json; charset=utf-8"
},
"Exception" : null
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringNotShowStatisticsButIncludeOpinionMining.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringNotShowStatisticsButIncludeOpinionMining.json
new file mode 100644
index 0000000000000..ac0d577a847e1
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringNotShowStatisticsButIncludeOpinionMining.json
@@ -0,0 +1,26 @@
+{
+ "networkCallRecords" : [ {
+ "Method" : "POST",
+ "Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment?showStats=false&opinionMining=true",
+ "Headers" : {
+ "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "c90fc67b-cac6-4a3e-9809-8537f74b56e8",
+ "Content-Type" : "application/json"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-envoy-upstream-service-time" : "972",
+ "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
+ "x-content-type-options" : "nosniff",
+ "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2",
+ "apim-request-id" : "becc195c-b463-42e1-b855-083626b7b648",
+ "retry-after" : "0",
+ "StatusCode" : "200",
+ "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\",\"aspects\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":4,\"length\":5,\"text\":\"hotel\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/0\"},{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/1\"}]}],\"opinions\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":14,\"length\":4,\"text\":\"dark\",\"isNegated\":false},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":23,\"length\":7,\"text\":\"unclean\",\"isNegated\":false}]},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\",\"aspects\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":59,\"length\":7,\"text\":\"gnocchi\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/1/opinions/0\"}]}],\"opinions\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":51,\"length\":7,\"text\":\"amazing\",\"isNegated\":false}]}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\",\"aspects\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":27,\"length\":7,\"text\":\"gnocchi\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/0/opinions/0\"}]}],\"opinions\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":19,\"length\":7,\"text\":\"amazing\",\"isNegated\":false}]},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\",\"aspects\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":40,\"length\":5,\"text\":\"hotel\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/1/opinions/0\"},{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/1/opinions/1\"}]}],\"opinions\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":50,\"length\":4,\"text\":\"dark\",\"isNegated\":false},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":59,\"length\":7,\"text\":\"unclean\",\"isNegated\":false}]}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}",
+ "Date" : "Thu, 13 Aug 2020 02:46:32 GMT",
+ "Content-Type" : "application/json; charset=utf-8"
+ },
+ "Exception" : null
+ } ],
+ "variables" : [ ]
+}
\ No newline at end of file
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringShowStatisticsAndIncludeOpinionMining.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringShowStatisticsAndIncludeOpinionMining.json
new file mode 100644
index 0000000000000..b098e8e75126f
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringShowStatisticsAndIncludeOpinionMining.json
@@ -0,0 +1,26 @@
+{
+ "networkCallRecords" : [ {
+ "Method" : "POST",
+ "Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment?showStats=true&opinionMining=true",
+ "Headers" : {
+ "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "7f42bc40-5d3f-45ee-8ef8-28515d9933f0",
+ "Content-Type" : "application/json"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-envoy-upstream-service-time" : "987",
+ "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
+ "x-content-type-options" : "nosniff",
+ "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2",
+ "apim-request-id" : "13f34c9f-abeb-406f-9552-85f7cd8573d0",
+ "retry-after" : "0",
+ "StatusCode" : "200",
+ "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\",\"aspects\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":4,\"length\":5,\"text\":\"hotel\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/0\"},{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/1\"}]}],\"opinions\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":14,\"length\":4,\"text\":\"dark\",\"isNegated\":false},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":23,\"length\":7,\"text\":\"unclean\",\"isNegated\":false}]},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\",\"aspects\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":59,\"length\":7,\"text\":\"gnocchi\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/1/opinions/0\"}]}],\"opinions\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":51,\"length\":7,\"text\":\"amazing\",\"isNegated\":false}]}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\",\"aspects\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":27,\"length\":7,\"text\":\"gnocchi\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/0/opinions/0\"}]}],\"opinions\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":19,\"length\":7,\"text\":\"amazing\",\"isNegated\":false}]},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\",\"aspects\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":40,\"length\":5,\"text\":\"hotel\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/1/opinions/0\"},{\"relationType\":\"opinion\",\"ref\":\"#/documents/1/sentences/1/opinions/1\"}]}],\"opinions\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":50,\"length\":4,\"text\":\"dark\",\"isNegated\":false},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":59,\"length\":7,\"text\":\"unclean\",\"isNegated\":false}]}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}",
+ "Date" : "Thu, 13 Aug 2020 02:46:47 GMT",
+ "Content-Type" : "application/json; charset=utf-8"
+ },
+ "Exception" : null
+ } ],
+ "variables" : [ ]
+}
\ No newline at end of file
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringShowStatisticsExcludeOpinionMining.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringShowStatisticsExcludeOpinionMining.json
new file mode 100644
index 0000000000000..8097ad72aef51
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringShowStatisticsExcludeOpinionMining.json
@@ -0,0 +1,26 @@
+{
+ "networkCallRecords" : [ {
+ "Method" : "POST",
+ "Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment?showStats=true&opinionMining=false",
+ "Headers" : {
+ "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "06ee858b-a4cb-4dfd-ba0d-4c79c9f5f847",
+ "Content-Type" : "application/json"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-envoy-upstream-service-time" : "1280",
+ "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
+ "x-content-type-options" : "nosniff",
+ "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2",
+ "apim-request-id" : "f10c179e-85d0-4496-850d-88bc981e4142",
+ "retry-after" : "0",
+ "StatusCode" : "200",
+ "Body" : "{\"statistics\":{\"documentsCount\":2,\"validDocumentsCount\":2,\"erroneousDocumentsCount\":0,\"transactionsCount\":2},\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"statistics\":{\"charactersCount\":67,\"transactionsCount\":1},\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}",
+ "Date" : "Thu, 13 Aug 2020 02:46:05 GMT",
+ "Content-Type" : "application/json; charset=utf-8"
+ },
+ "Exception" : null
+ } ],
+ "variables" : [ ]
+}
\ No newline at end of file
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringWithLanguageHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringWithLanguageHint.json
new file mode 100644
index 0000000000000..0b1bd47334463
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForListStringWithLanguageHint.json
@@ -0,0 +1,26 @@
+{
+ "networkCallRecords" : [ {
+ "Method" : "POST",
+ "Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment?showStats=false&opinionMining=false",
+ "Headers" : {
+ "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "a427d4e9-57e4-4e93-847e-30f88dfe3f93",
+ "Content-Type" : "application/json"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-envoy-upstream-service-time" : "426",
+ "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
+ "x-content-type-options" : "nosniff",
+ "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=2",
+ "apim-request-id" : "52b8dd67-927d-4e76-bef0-6e8db9f70e0d",
+ "retry-after" : "0",
+ "StatusCode" : "200",
+ "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]},{\"id\":\"1\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":0,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":36,\"length\":31,\"text\":\"The hotel was dark and unclean.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}",
+ "Date" : "Wed, 19 Aug 2020 12:13:39 GMT",
+ "Content-Type" : "application/json; charset=utf-8"
+ },
+ "Exception" : null
+ } ],
+ "variables" : [ ]
+}
\ No newline at end of file
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInput.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInput.json
index d32e2e898c1b7..17db8e025e742 100644
--- a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInput.json
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInput.json
@@ -3,21 +3,21 @@
"Method" : "POST",
"Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment",
"Headers" : {
- "User-Agent" : "azsdk-java-azure-ai-textanalytics/1.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
- "x-ms-client-request-id" : "6d57c5af-70da-47e5-b258-8c5bb75ec473",
+ "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "e1b7b36e-90a4-4bc3-aa4f-c49334e219b0",
"Content-Type" : "application/json"
},
"Response" : {
"Transfer-Encoding" : "chunked",
- "x-envoy-upstream-service-time" : "87",
+ "x-envoy-upstream-service-time" : "494",
"Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
"x-content-type-options" : "nosniff",
"csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1",
- "apim-request-id" : "78660fca-0348-4a7d-8e3d-ac2e82141f7f",
+ "apim-request-id" : "b398ccd5-907d-4513-88ae-3b746c38429f",
"retry-after" : "0",
"StatusCode" : "200",
"Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}",
- "Date" : "Wed, 15 Jul 2020 04:14:36 GMT",
+ "Date" : "Wed, 19 Aug 2020 12:14:29 GMT",
"Content-Type" : "application/json; charset=utf-8"
},
"Exception" : null
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInputWithDefaultLanguageHint.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInputWithDefaultLanguageHint.json
new file mode 100644
index 0000000000000..a203cbfdce987
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInputWithDefaultLanguageHint.json
@@ -0,0 +1,26 @@
+{
+ "networkCallRecords" : [ {
+ "Method" : "POST",
+ "Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment",
+ "Headers" : {
+ "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "cb07bf78-08e5-4cb8-9dfb-60f6f8172267",
+ "Content-Type" : "application/json"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-envoy-upstream-service-time" : "1036",
+ "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
+ "x-content-type-options" : "nosniff",
+ "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1",
+ "apim-request-id" : "be002d0a-abc9-43b7-8514-c989f178365b",
+ "retry-after" : "0",
+ "StatusCode" : "200",
+ "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\"},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\"}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}",
+ "Date" : "Wed, 19 Aug 2020 12:15:06 GMT",
+ "Content-Type" : "application/json; charset=utf-8"
+ },
+ "Exception" : null
+ } ],
+ "variables" : [ ]
+}
\ No newline at end of file
diff --git a/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInputWithOpinionMining.json b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInputWithOpinionMining.json
new file mode 100644
index 0000000000000..090ca46e03c8a
--- /dev/null
+++ b/sdk/textanalytics/azure-ai-textanalytics/src/test/resources/session-records/analyzeSentimentForTextInputWithOpinionMining.json
@@ -0,0 +1,26 @@
+{
+ "networkCallRecords" : [ {
+ "Method" : "POST",
+ "Uri" : "https://REDACTED.cognitiveservices.azure.com/text/analytics/v3.1-preview.1//sentiment?showStats=false&opinionMining=true",
+ "Headers" : {
+ "User-Agent" : "azsdk-java-azure-ai-textanalytics/5.1.0-beta.1 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "3875ba1c-2304-4f9b-ba0b-4dc1099ec029",
+ "Content-Type" : "application/json"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-envoy-upstream-service-time" : "1369",
+ "Strict-Transport-Security" : "max-age=31536000; includeSubDomains; preload",
+ "x-content-type-options" : "nosniff",
+ "csp-billing-usage" : "CognitiveServices.TextAnalytics.BatchScoring=1",
+ "apim-request-id" : "1dd802b2-9892-45a5-b8dc-cc879a0aff33",
+ "retry-after" : "0",
+ "StatusCode" : "200",
+ "Body" : "{\"documents\":[{\"id\":\"0\",\"sentiment\":\"mixed\",\"confidenceScores\":{\"positive\":0.5,\"neutral\":0.0,\"negative\":0.5},\"sentences\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"neutral\":0.0,\"negative\":1.0},\"offset\":0,\"length\":31,\"text\":\"The hotel was dark and unclean.\",\"aspects\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":4,\"length\":5,\"text\":\"hotel\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/0\"},{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/0/opinions/1\"}]}],\"opinions\":[{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":14,\"length\":4,\"text\":\"dark\",\"isNegated\":false},{\"sentiment\":\"negative\",\"confidenceScores\":{\"positive\":0.0,\"negative\":1.0},\"offset\":23,\"length\":7,\"text\":\"unclean\",\"isNegated\":false}]},{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"neutral\":0.0,\"negative\":0.0},\"offset\":32,\"length\":35,\"text\":\"The restaurant had amazing gnocchi.\",\"aspects\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":59,\"length\":7,\"text\":\"gnocchi\",\"relations\":[{\"relationType\":\"opinion\",\"ref\":\"#/documents/0/sentences/1/opinions/0\"}]}],\"opinions\":[{\"sentiment\":\"positive\",\"confidenceScores\":{\"positive\":1.0,\"negative\":0.0},\"offset\":51,\"length\":7,\"text\":\"amazing\",\"isNegated\":false}]}],\"warnings\":[]}],\"errors\":[],\"modelVersion\":\"2020-04-01\"}",
+ "Date" : "Wed, 19 Aug 2020 06:32:59 GMT",
+ "Content-Type" : "application/json; charset=utf-8"
+ },
+ "Exception" : null
+ } ],
+ "variables" : [ ]
+}
\ No newline at end of file
From 0015dd669fc2c0310a7658f77d1e512241d29104 Mon Sep 17 00:00:00 2001
From: Wes Haggard
Date: Sat, 29 Aug 2020 16:38:32 -0700
Subject: [PATCH 003/168] Remove myself from every versioning changes
---
.github/CODEOWNERS | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 80575f7900a87..a310272305332 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -85,7 +85,7 @@
/eng/code-quality-reports/ @mssfang @JonathanGiles
/eng/jacoco-test-coverage/ @srnagar @JonathanGiles
/eng/spotbugs-aggregate-report/ @srnagar @JonathanGiles
-/eng/versioning/ @JimSuplizio @mitchdenny @weshaggard @danieljurek @alzimmermsft @samvaity
+/eng/versioning/ @JimSuplizio @mitchdenny @danieljurek @alzimmermsft @samvaity
/parent/ @JimSuplizio @alzimmermsft
/**/tests.yml @danieljurek
From 6a833f14a01a815bbcb7d619694ed0e455b57b2d Mon Sep 17 00:00:00 2001
From: Chuang <54572251+xccc-msft@users.noreply.github.com>
Date: Mon, 31 Aug 2020 12:00:55 +0800
Subject: [PATCH 004/168] LogAnalytics: generate package-2020-08 (#14631)
* generate package-2020-08
* fix compile errors
* fix deleteAsync
---
sdk/loganalytics/mgmt-v2020_08_01/pom.xml | 135 +++
.../v2020_08_01/AvailableServiceTier.java | 55 +
.../v2020_08_01/AvailableServiceTiers.java | 29 +
.../v2020_08_01/AzureEntityResource.java | 34 +
.../loganalytics/v2020_08_01/Cluster.java | 170 +++
.../v2020_08_01/ClusterEntityStatus.java | 56 +
.../v2020_08_01/ClusterErrorResponse.java | 44 +
.../ClusterErrorResponseException.java | 45 +
.../v2020_08_01/ClusterPatch.java | 98 ++
.../loganalytics/v2020_08_01/ClusterSku.java | 69 ++
.../v2020_08_01/ClusterSkuNameEnum.java | 38 +
.../loganalytics/v2020_08_01/Clusters.java | 25 +
.../loganalytics/v2020_08_01/CoreSummary.java | 69 ++
.../loganalytics/v2020_08_01/DataExport.java | 314 +++++
.../v2020_08_01/DataExportErrorResponse.java | 44 +
.../DataExportErrorResponseException.java | 45 +
.../loganalytics/v2020_08_01/DataExports.java | 53 +
.../v2020_08_01/DataIngestionStatus.java | 53 +
.../loganalytics/v2020_08_01/DataSource.java | 181 +++
.../v2020_08_01/DataSourceFilter.java | 57 +
.../v2020_08_01/DataSourceKind.java | 134 +++
.../v2020_08_01/DataSourceType.java | 59 +
.../loganalytics/v2020_08_01/DataSources.java | 54 +
.../v2020_08_01/DeletedWorkspaces.java | 20 +
.../v2020_08_01/ErrorAdditionalInfo.java | 47 +
.../v2020_08_01/ErrorContract.java | 44 +
.../v2020_08_01/ErrorContractException.java | 44 +
.../v2020_08_01/ErrorResponse.java | 93 ++
.../loganalytics/v2020_08_01/Gateways.java | 30 +
.../loganalytics/v2020_08_01/Identity.java | 73 ++
.../v2020_08_01/IdentityType.java | 53 +
.../v2020_08_01/IntelligencePack.java | 35 +
.../v2020_08_01/IntelligencePacks.java | 52 +
.../v2020_08_01/KeyVaultProperties.java | 96 ++
.../v2020_08_01/LinkedService.java | 205 ++++
.../LinkedServiceEntityStatus.java | 47 +
.../v2020_08_01/LinkedServices.java | 53 +
.../v2020_08_01/LinkedStorageAccounts.java | 53 +
.../LinkedStorageAccountsResource.java | 123 ++
.../v2020_08_01/ManagementGroup.java | 61 +
.../v2020_08_01/ManagementGroups.java | 29 +
.../loganalytics/v2020_08_01/MetricName.java | 69 ++
.../loganalytics/v2020_08_01/Operation.java | 30 +
.../v2020_08_01/OperationDisplay.java | 121 ++
.../v2020_08_01/OperationStatus.java | 52 +
.../v2020_08_01/OperationStatuses.java | 29 +
.../loganalytics/v2020_08_01/Operations.java | 27 +
.../PrivateLinkScopedResource.java | 69 ++
.../v2020_08_01/PublicNetworkAccessType.java | 41 +
.../loganalytics/v2020_08_01/PurgeState.java | 41 +
.../loganalytics/v2020_08_01/SavedSearch.java | 285 +++++
.../v2020_08_01/SavedSearches.java | 53 +
.../v2020_08_01/SavedSearchesListResult.java | 27 +
.../loganalytics/v2020_08_01/Schemas.java | 29 +
.../v2020_08_01/SearchGetSchemaResponse.java | 31 +
.../v2020_08_01/SearchMetadata.java | 461 +++++++
.../v2020_08_01/SearchMetadataSchema.java | 69 ++
.../v2020_08_01/SearchSchemaValue.java | 200 ++++
.../loganalytics/v2020_08_01/SearchSort.java | 69 ++
.../v2020_08_01/SearchSortEnum.java | 41 +
.../loganalytics/v2020_08_01/SharedKeys.java | 30 +
.../v2020_08_01/SharedKeysOperations.java | 39 +
.../loganalytics/v2020_08_01/SkuNameEnum.java | 56 +
.../v2020_08_01/StorageAccount.java | 69 ++
.../v2020_08_01/StorageInsight.java | 228 ++++
.../v2020_08_01/StorageInsightConfigs.java | 53 +
.../v2020_08_01/StorageInsightState.java | 41 +
.../v2020_08_01/StorageInsightStatus.java | 70 ++
.../loganalytics/v2020_08_01/Table.java | 67 ++
.../loganalytics/v2020_08_01/Tables.java | 40 +
.../loganalytics/v2020_08_01/Tag.java | 69 ++
.../loganalytics/v2020_08_01/Type.java | 41 +
.../loganalytics/v2020_08_01/UsageMetric.java | 51 +
.../loganalytics/v2020_08_01/Usages.java | 29 +
.../loganalytics/v2020_08_01/Workspace.java | 270 +++++
.../v2020_08_01/WorkspaceCapping.java | 75 ++
.../v2020_08_01/WorkspaceEntityStatus.java | 56 +
.../v2020_08_01/WorkspaceModel.java | 69 ++
.../v2020_08_01/WorkspacePatch.java | 238 ++++
.../v2020_08_01/WorkspacePurgeBody.java | 71 ++
.../WorkspacePurgeBodyFilters.java | 125 ++
.../WorkspacePurgePurgeHeaders.java | 43 +
.../v2020_08_01/WorkspacePurgeResponse.java | 25 +
.../WorkspacePurgeStatusResponse.java | 25 +
.../v2020_08_01/WorkspacePurges.java | 42 +
.../v2020_08_01/WorkspaceSku.java | 102 ++
.../v2020_08_01/WorkspaceSkuNameEnum.java | 56 +
.../loganalytics/v2020_08_01/Workspaces.java | 25 +
.../AvailableServiceTierImpl.java | 66 +
.../AvailableServiceTierInner.java | 127 ++
.../AvailableServiceTiersImpl.java | 53 +
.../AvailableServiceTiersInner.java | 147 +++
.../implementation/ClusterImpl.java | 133 +++
.../implementation/ClusterInner.java | 160 +++
.../implementation/ClustersImpl.java | 138 +++
.../implementation/ClustersInner.java | 1062 +++++++++++++++++
.../implementation/DataExportImpl.java | 189 +++
.../implementation/DataExportInner.java | 248 ++++
.../implementation/DataExportsImpl.java | 85 ++
.../implementation/DataExportsInner.java | 456 +++++++
.../implementation/DataSourceImpl.java | 140 +++
.../implementation/DataSourceInner.java | 139 +++
.../implementation/DataSourcesImpl.java | 85 ++
.../implementation/DataSourcesInner.java | 746 ++++++++++++
.../implementation/DeletedWorkspacesImpl.java | 95 ++
.../DeletedWorkspacesInner.java | 237 ++++
.../implementation/GatewaysImpl.java | 32 +
.../implementation/GatewaysInner.java | 152 +++
.../implementation/IdParsingUtils.java | 57 +
.../implementation/IntelligencePackImpl.java | 45 +
.../implementation/IntelligencePackInner.java | 96 ++
.../implementation/IntelligencePacksImpl.java | 66 +
.../IntelligencePacksInner.java | 340 ++++++
.../implementation/LinkedServiceImpl.java | 140 +++
.../implementation/LinkedServiceInner.java | 129 ++
.../implementation/LinkedServicesImpl.java | 85 ++
.../implementation/LinkedServicesInner.java | 625 ++++++++++
.../LinkedStorageAccountsImpl.java | 86 ++
.../LinkedStorageAccountsInner.java | 543 +++++++++
.../LinkedStorageAccountsResourceImpl.java | 118 ++
.../LinkedStorageAccountsResourceInner.java | 64 +
.../implementation/LogAnalyticsManager.java | 327 +++++
.../implementation/ManagementGroupImpl.java | 71 ++
.../implementation/ManagementGroupInner.java | 229 ++++
.../implementation/ManagementGroupsImpl.java | 53 +
.../implementation/ManagementGroupsInner.java | 152 +++
.../implementation/OperationImpl.java | 37 +
.../implementation/OperationInner.java | 70 ++
.../implementation/OperationStatusImpl.java | 72 ++
.../implementation/OperationStatusInner.java | 174 +++
.../implementation/OperationStatusesImpl.java | 50 +
.../OperationStatusesInner.java | 146 +++
...erationalInsightsManagementClientImpl.java | 462 +++++++
.../implementation/OperationsImpl.java | 49 +
.../implementation/OperationsInner.java | 283 +++++
.../v2020_08_01/implementation/PageImpl.java | 75 ++
.../v2020_08_01/implementation/PageImpl1.java | 75 ++
.../v2020_08_01/implementation/PageImpl2.java | 75 ++
.../implementation/SavedSearchImpl.java | 184 +++
.../implementation/SavedSearchInner.java | 236 ++++
.../implementation/SavedSearchesImpl.java | 79 ++
.../implementation/SavedSearchesInner.java | 448 +++++++
.../SavedSearchesListResultImpl.java | 32 +
.../SavedSearchesListResultInner.java | 44 +
.../implementation/SchemasImpl.java | 42 +
.../implementation/SchemasInner.java | 146 +++
.../SearchGetSchemaResponseImpl.java | 39 +
.../SearchGetSchemaResponseInner.java | 72 ++
.../implementation/SharedKeysImpl.java | 36 +
.../implementation/SharedKeysInner.java | 69 ++
.../SharedKeysOperationsImpl.java | 54 +
.../SharedKeysOperationsInner.java | 236 ++++
.../StorageInsightConfigsImpl.java | 85 ++
.../StorageInsightConfigsInner.java | 608 ++++++++++
.../implementation/StorageInsightImpl.java | 158 +++
.../implementation/StorageInsightInner.java | 169 +++
.../v2020_08_01/implementation/TableImpl.java | 98 ++
.../implementation/TableInner.java | 47 +
.../implementation/TablesImpl.java | 69 ++
.../implementation/TablesInner.java | 443 +++++++
.../implementation/UsageMetricImpl.java | 62 +
.../implementation/UsageMetricInner.java | 176 +++
.../implementation/UsagesImpl.java | 53 +
.../implementation/UsagesInner.java | 152 +++
.../implementation/WorkspaceImpl.java | 184 +++
.../implementation/WorkspaceInner.java | 243 ++++
.../implementation/WorkspaceModelImpl.java | 91 ++
.../WorkspacePurgeResponseImpl.java | 31 +
.../WorkspacePurgeResponseInner.java | 43 +
.../WorkspacePurgeStatusResponseImpl.java | 39 +
.../WorkspacePurgeStatusResponseInner.java | 45 +
.../implementation/WorkspacePurgesImpl.java | 64 +
.../implementation/WorkspacePurgesInner.java | 261 ++++
.../implementation/WorkspacesImpl.java | 138 +++
.../implementation/WorkspacesInner.java | 932 +++++++++++++++
.../implementation/package-info.java | 11 +
.../v2020_08_01/package-info.java | 11 +
sdk/loganalytics/pom.mgmt.xml | 1 +
178 files changed, 22083 insertions(+)
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/pom.xml
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/AvailableServiceTier.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/AvailableServiceTiers.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/AzureEntityResource.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Cluster.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterEntityStatus.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterErrorResponse.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterErrorResponseException.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterPatch.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterSku.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterSkuNameEnum.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Clusters.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/CoreSummary.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataExport.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataExportErrorResponse.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataExportErrorResponseException.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataExports.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataIngestionStatus.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSource.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSourceFilter.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSourceKind.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSourceType.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSources.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DeletedWorkspaces.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ErrorAdditionalInfo.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ErrorContract.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ErrorContractException.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ErrorResponse.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Gateways.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Identity.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/IdentityType.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/IntelligencePack.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/IntelligencePacks.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/KeyVaultProperties.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/LinkedService.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/LinkedServiceEntityStatus.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/LinkedServices.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/LinkedStorageAccounts.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/LinkedStorageAccountsResource.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ManagementGroup.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ManagementGroups.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/MetricName.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Operation.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/OperationDisplay.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/OperationStatus.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/OperationStatuses.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Operations.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/PrivateLinkScopedResource.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/PublicNetworkAccessType.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/PurgeState.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/SavedSearch.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/SavedSearches.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/SavedSearchesListResult.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Schemas.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/SearchGetSchemaResponse.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/SearchMetadata.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/SearchMetadataSchema.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/SearchSchemaValue.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/SearchSort.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/SearchSortEnum.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/SharedKeys.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/SharedKeysOperations.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/SkuNameEnum.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/StorageAccount.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/StorageInsight.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/StorageInsightConfigs.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/StorageInsightState.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/StorageInsightStatus.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Table.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Tables.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Tag.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Type.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/UsageMetric.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Usages.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Workspace.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/WorkspaceCapping.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/WorkspaceEntityStatus.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/WorkspaceModel.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/WorkspacePatch.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/WorkspacePurgeBody.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/WorkspacePurgeBodyFilters.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/WorkspacePurgePurgeHeaders.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/WorkspacePurgeResponse.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/WorkspacePurgeStatusResponse.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/WorkspacePurges.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/WorkspaceSku.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/WorkspaceSkuNameEnum.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Workspaces.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/AvailableServiceTierImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/AvailableServiceTierInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/AvailableServiceTiersImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/AvailableServiceTiersInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/ClusterImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/ClusterInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/ClustersImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/ClustersInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/DataExportImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/DataExportInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/DataExportsImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/DataExportsInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/DataSourceImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/DataSourceInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/DataSourcesImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/DataSourcesInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/DeletedWorkspacesImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/DeletedWorkspacesInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/GatewaysImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/GatewaysInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/IdParsingUtils.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/IntelligencePackImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/IntelligencePackInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/IntelligencePacksImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/IntelligencePacksInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/LinkedServiceImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/LinkedServiceInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/LinkedServicesImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/LinkedServicesInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/LinkedStorageAccountsImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/LinkedStorageAccountsInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/LinkedStorageAccountsResourceImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/LinkedStorageAccountsResourceInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/LogAnalyticsManager.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/ManagementGroupImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/ManagementGroupInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/ManagementGroupsImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/ManagementGroupsInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/OperationImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/OperationInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/OperationStatusImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/OperationStatusInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/OperationStatusesImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/OperationStatusesInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/OperationalInsightsManagementClientImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/OperationsImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/OperationsInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/PageImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/PageImpl1.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/PageImpl2.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/SavedSearchImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/SavedSearchInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/SavedSearchesImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/SavedSearchesInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/SavedSearchesListResultImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/SavedSearchesListResultInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/SchemasImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/SchemasInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/SearchGetSchemaResponseImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/SearchGetSchemaResponseInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/SharedKeysImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/SharedKeysInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/SharedKeysOperationsImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/SharedKeysOperationsInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/StorageInsightConfigsImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/StorageInsightConfigsInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/StorageInsightImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/StorageInsightInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/TableImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/TableInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/TablesImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/TablesInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/UsageMetricImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/UsageMetricInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/UsagesImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/UsagesInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/WorkspaceImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/WorkspaceInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/WorkspaceModelImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/WorkspacePurgeResponseImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/WorkspacePurgeResponseInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/WorkspacePurgeStatusResponseImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/WorkspacePurgeStatusResponseInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/WorkspacePurgesImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/WorkspacePurgesInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/WorkspacesImpl.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/WorkspacesInner.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/implementation/package-info.java
create mode 100644 sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/package-info.java
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/pom.xml b/sdk/loganalytics/mgmt-v2020_08_01/pom.xml
new file mode 100644
index 0000000000000..8835a3aa98d28
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/pom.xml
@@ -0,0 +1,135 @@
+
+
+ 4.0.0
+ com.microsoft.azure.loganalytics.v2020_08_01
+
+ com.microsoft.azure
+ azure-arm-parent
+ 1.3.2
+ ../../parents/azure-arm-parent/pom.xml
+
+ azure-mgmt-loganalytics
+ 1.0.0-beta
+ jar
+ Microsoft Azure SDK for LogAnalytics Management
+ This package contains Microsoft LogAnalytics Management SDK.
+ https://github.com/Azure/azure-sdk-for-java
+
+
+ The MIT License (MIT)
+ http://opensource.org/licenses/MIT
+ repo
+
+
+
+ scm:git:https://github.com/Azure/azure-sdk-for-java
+ scm:git:git@github.com:Azure/azure-sdk-for-java.git
+ HEAD
+
+
+ UTF-8
+
+
+
+
+ microsoft
+ Microsoft
+
+
+
+
+ com.microsoft.azure
+ azure-client-runtime
+
+
+ com.microsoft.azure
+ azure-arm-client-runtime
+
+
+ junit
+ junit
+ test
+
+
+ com.microsoft.azure
+ azure-client-authentication
+ test
+
+
+ com.microsoft.azure
+ azure-mgmt-resources
+ test
+
+
+ com.microsoft.azure
+ azure-arm-client-runtime
+ test-jar
+ test
+
+ 1.6.5
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ true
+ true
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.1
+
+
+ 1.7
+
+
+ com.microsoft.azure.management.apigeneration.LangDefinitionProcessor
+
+
+ true
+ true
+
+ true
+ true
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.8
+
+ *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search
+
+
+ /**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ */
+ ]]>
+
+
+
+
+
+
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/AvailableServiceTier.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/AvailableServiceTier.java
new file mode 100644
index 0000000000000..3d6c75c3df8b5
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/AvailableServiceTier.java
@@ -0,0 +1,55 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.microsoft.azure.arm.model.HasInner;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.AvailableServiceTierInner;
+import com.microsoft.azure.arm.resources.models.HasManager;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.LogAnalyticsManager;
+
+/**
+ * Type representing AvailableServiceTier.
+ */
+public interface AvailableServiceTier extends HasInner, HasManager {
+ /**
+ * @return the capacityReservationLevel value.
+ */
+ Long capacityReservationLevel();
+
+ /**
+ * @return the defaultRetention value.
+ */
+ Long defaultRetention();
+
+ /**
+ * @return the enabled value.
+ */
+ Boolean enabled();
+
+ /**
+ * @return the lastSkuUpdate value.
+ */
+ String lastSkuUpdate();
+
+ /**
+ * @return the maximumRetention value.
+ */
+ Long maximumRetention();
+
+ /**
+ * @return the minimumRetention value.
+ */
+ Long minimumRetention();
+
+ /**
+ * @return the serviceTier value.
+ */
+ SkuNameEnum serviceTier();
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/AvailableServiceTiers.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/AvailableServiceTiers.java
new file mode 100644
index 0000000000000..ce1609d585308
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/AvailableServiceTiers.java
@@ -0,0 +1,29 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import rx.Observable;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.AvailableServiceTiersInner;
+import com.microsoft.azure.arm.model.HasInner;
+
+/**
+ * Type representing AvailableServiceTiers.
+ */
+public interface AvailableServiceTiers extends HasInner {
+ /**
+ * Gets the available service tiers for the workspace.
+ *
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
+ * @param workspaceName The name of the workspace.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Observable listByWorkspaceAsync(String resourceGroupName, String workspaceName);
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/AzureEntityResource.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/AzureEntityResource.java
new file mode 100644
index 0000000000000..caa5df6dfdd74
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/AzureEntityResource.java
@@ -0,0 +1,34 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.microsoft.azure.ProxyResource;
+
+/**
+ * The resource model definition for a Azure Resource Manager resource with an
+ * etag.
+ */
+public class AzureEntityResource extends ProxyResource {
+ /**
+ * Resource Etag.
+ */
+ @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY)
+ private String etag;
+
+ /**
+ * Get resource Etag.
+ *
+ * @return the etag value
+ */
+ public String etag() {
+ return this.etag;
+ }
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Cluster.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Cluster.java
new file mode 100644
index 0000000000000..d8af7670f6c1d
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Cluster.java
@@ -0,0 +1,170 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.microsoft.azure.arm.model.HasInner;
+import com.microsoft.azure.arm.resources.models.Resource;
+import com.microsoft.azure.arm.resources.models.GroupableResourceCore;
+import com.microsoft.azure.arm.resources.models.HasResourceGroup;
+import com.microsoft.azure.arm.model.Refreshable;
+import com.microsoft.azure.arm.model.Updatable;
+import com.microsoft.azure.arm.model.Appliable;
+import com.microsoft.azure.arm.model.Creatable;
+import com.microsoft.azure.arm.resources.models.HasManager;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.LogAnalyticsManager;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.ClusterInner;
+
+/**
+ * Type representing Cluster.
+ */
+public interface Cluster extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager {
+ /**
+ * @return the clusterId value.
+ */
+ String clusterId();
+
+ /**
+ * @return the identity value.
+ */
+ Identity identity();
+
+ /**
+ * @return the keyVaultProperties value.
+ */
+ KeyVaultProperties keyVaultProperties();
+
+ /**
+ * @return the nextLink value.
+ */
+ String nextLink();
+
+ /**
+ * @return the provisioningState value.
+ */
+ ClusterEntityStatus provisioningState();
+
+ /**
+ * @return the sku value.
+ */
+ ClusterSku sku();
+
+ /**
+ * The entirety of the Cluster definition.
+ */
+ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate {
+ }
+
+ /**
+ * Grouping of Cluster definition stages.
+ */
+ interface DefinitionStages {
+ /**
+ * The first stage of a Cluster definition.
+ */
+ interface Blank extends GroupableResourceCore.DefinitionWithRegion {
+ }
+
+ /**
+ * The stage of the Cluster definition allowing to specify the resource group.
+ */
+ interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup {
+ }
+
+ /**
+ * The stage of the cluster definition allowing to specify Identity.
+ */
+ interface WithIdentity {
+ /**
+ * Specifies identity.
+ * @param identity The identity of the resource
+ * @return the next definition stage
+ */
+ WithCreate withIdentity(Identity identity);
+ }
+
+ /**
+ * The stage of the cluster definition allowing to specify KeyVaultProperties.
+ */
+ interface WithKeyVaultProperties {
+ /**
+ * Specifies keyVaultProperties.
+ * @param keyVaultProperties The associated key properties
+ * @return the next definition stage
+ */
+ WithCreate withKeyVaultProperties(KeyVaultProperties keyVaultProperties);
+ }
+
+ /**
+ * The stage of the cluster definition allowing to specify NextLink.
+ */
+ interface WithNextLink {
+ /**
+ * Specifies nextLink.
+ * @param nextLink The link used to get the next page of recommendations
+ * @return the next definition stage
+ */
+ WithCreate withNextLink(String nextLink);
+ }
+
+ /**
+ * The stage of the cluster definition allowing to specify Sku.
+ */
+ interface WithSku {
+ /**
+ * Specifies sku.
+ * @param sku The sku properties
+ * @return the next definition stage
+ */
+ WithCreate withSku(ClusterSku sku);
+ }
+
+ /**
+ * The stage of the definition which contains all the minimum required inputs for
+ * the resource to be created (via {@link WithCreate#create()}), but also allows
+ * for any other optional settings to be specified.
+ */
+ interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithIdentity, DefinitionStages.WithKeyVaultProperties, DefinitionStages.WithNextLink, DefinitionStages.WithSku {
+ }
+ }
+ /**
+ * The template for a Cluster update operation, containing all the settings that can be modified.
+ */
+ interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithKeyVaultProperties, UpdateStages.WithSku {
+ }
+
+ /**
+ * Grouping of Cluster update stages.
+ */
+ interface UpdateStages {
+ /**
+ * The stage of the cluster update allowing to specify KeyVaultProperties.
+ */
+ interface WithKeyVaultProperties {
+ /**
+ * Specifies keyVaultProperties.
+ * @param keyVaultProperties The associated key properties
+ * @return the next update stage
+ */
+ Update withKeyVaultProperties(KeyVaultProperties keyVaultProperties);
+ }
+
+ /**
+ * The stage of the cluster update allowing to specify Sku.
+ */
+ interface WithSku {
+ /**
+ * Specifies sku.
+ * @param sku The sku properties
+ * @return the next update stage
+ */
+ Update withSku(ClusterSku sku);
+ }
+
+ }
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterEntityStatus.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterEntityStatus.java
new file mode 100644
index 0000000000000..918c81c94ef5c
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterEntityStatus.java
@@ -0,0 +1,56 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import java.util.Collection;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.microsoft.rest.ExpandableStringEnum;
+
+/**
+ * Defines values for ClusterEntityStatus.
+ */
+public final class ClusterEntityStatus extends ExpandableStringEnum {
+ /** Static value Creating for ClusterEntityStatus. */
+ public static final ClusterEntityStatus CREATING = fromString("Creating");
+
+ /** Static value Succeeded for ClusterEntityStatus. */
+ public static final ClusterEntityStatus SUCCEEDED = fromString("Succeeded");
+
+ /** Static value Failed for ClusterEntityStatus. */
+ public static final ClusterEntityStatus FAILED = fromString("Failed");
+
+ /** Static value Canceled for ClusterEntityStatus. */
+ public static final ClusterEntityStatus CANCELED = fromString("Canceled");
+
+ /** Static value Deleting for ClusterEntityStatus. */
+ public static final ClusterEntityStatus DELETING = fromString("Deleting");
+
+ /** Static value ProvisioningAccount for ClusterEntityStatus. */
+ public static final ClusterEntityStatus PROVISIONING_ACCOUNT = fromString("ProvisioningAccount");
+
+ /** Static value Updating for ClusterEntityStatus. */
+ public static final ClusterEntityStatus UPDATING = fromString("Updating");
+
+ /**
+ * Creates or finds a ClusterEntityStatus from its string representation.
+ * @param name a name to look for
+ * @return the corresponding ClusterEntityStatus
+ */
+ @JsonCreator
+ public static ClusterEntityStatus fromString(String name) {
+ return fromString(name, ClusterEntityStatus.class);
+ }
+
+ /**
+ * @return known ClusterEntityStatus values
+ */
+ public static Collection values() {
+ return values(ClusterEntityStatus.class);
+ }
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterErrorResponse.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterErrorResponse.java
new file mode 100644
index 0000000000000..6740dc53cdaa2
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterErrorResponse.java
@@ -0,0 +1,44 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Error response indicates that the service is not able to process the
+ * incoming request. The reason is provided in the error message.
+ */
+public class ClusterErrorResponse {
+ /**
+ * The details of the error.
+ */
+ @JsonProperty(value = "error")
+ private ErrorResponse error;
+
+ /**
+ * Get the details of the error.
+ *
+ * @return the error value
+ */
+ public ErrorResponse error() {
+ return this.error;
+ }
+
+ /**
+ * Set the details of the error.
+ *
+ * @param error the error value to set
+ * @return the ClusterErrorResponse object itself.
+ */
+ public ClusterErrorResponse withError(ErrorResponse error) {
+ this.error = error;
+ return this;
+ }
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterErrorResponseException.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterErrorResponseException.java
new file mode 100644
index 0000000000000..14a13ec79e105
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterErrorResponseException.java
@@ -0,0 +1,45 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.microsoft.rest.RestException;
+import okhttp3.ResponseBody;
+import retrofit2.Response;
+
+/**
+ * Exception thrown for an invalid response with ClusterErrorResponse
+ * information.
+ */
+public class ClusterErrorResponseException extends RestException {
+ /**
+ * Initializes a new instance of the ClusterErrorResponseException class.
+ *
+ * @param message the exception message or the response content if a message is not available
+ * @param response the HTTP response
+ */
+ public ClusterErrorResponseException(final String message, final Response response) {
+ super(message, response);
+ }
+
+ /**
+ * Initializes a new instance of the ClusterErrorResponseException class.
+ *
+ * @param message the exception message or the response content if a message is not available
+ * @param response the HTTP response
+ * @param body the deserialized response body
+ */
+ public ClusterErrorResponseException(final String message, final Response response, final ClusterErrorResponse body) {
+ super(message, response, body);
+ }
+
+ @Override
+ public ClusterErrorResponse body() {
+ return (ClusterErrorResponse) super.body();
+ }
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterPatch.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterPatch.java
new file mode 100644
index 0000000000000..072bf6ac1eb96
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterPatch.java
@@ -0,0 +1,98 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.microsoft.rest.serializer.JsonFlatten;
+
+/**
+ * The top level Log Analytics cluster resource container.
+ */
+@JsonFlatten
+public class ClusterPatch {
+ /**
+ * The associated key properties.
+ */
+ @JsonProperty(value = "properties.keyVaultProperties")
+ private KeyVaultProperties keyVaultProperties;
+
+ /**
+ * The sku properties.
+ */
+ @JsonProperty(value = "sku")
+ private ClusterSku sku;
+
+ /**
+ * Resource tags.
+ */
+ @JsonProperty(value = "tags")
+ private Map tags;
+
+ /**
+ * Get the associated key properties.
+ *
+ * @return the keyVaultProperties value
+ */
+ public KeyVaultProperties keyVaultProperties() {
+ return this.keyVaultProperties;
+ }
+
+ /**
+ * Set the associated key properties.
+ *
+ * @param keyVaultProperties the keyVaultProperties value to set
+ * @return the ClusterPatch object itself.
+ */
+ public ClusterPatch withKeyVaultProperties(KeyVaultProperties keyVaultProperties) {
+ this.keyVaultProperties = keyVaultProperties;
+ return this;
+ }
+
+ /**
+ * Get the sku properties.
+ *
+ * @return the sku value
+ */
+ public ClusterSku sku() {
+ return this.sku;
+ }
+
+ /**
+ * Set the sku properties.
+ *
+ * @param sku the sku value to set
+ * @return the ClusterPatch object itself.
+ */
+ public ClusterPatch withSku(ClusterSku sku) {
+ this.sku = sku;
+ return this;
+ }
+
+ /**
+ * Get resource tags.
+ *
+ * @return the tags value
+ */
+ public Map tags() {
+ return this.tags;
+ }
+
+ /**
+ * Set resource tags.
+ *
+ * @param tags the tags value to set
+ * @return the ClusterPatch object itself.
+ */
+ public ClusterPatch withTags(Map tags) {
+ this.tags = tags;
+ return this;
+ }
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterSku.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterSku.java
new file mode 100644
index 0000000000000..d9814fd6fb3e8
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterSku.java
@@ -0,0 +1,69 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * The cluster sku definition.
+ */
+public class ClusterSku {
+ /**
+ * The capacity value.
+ */
+ @JsonProperty(value = "capacity")
+ private Long capacity;
+
+ /**
+ * The name of the SKU. Possible values include: 'CapacityReservation'.
+ */
+ @JsonProperty(value = "name")
+ private ClusterSkuNameEnum name;
+
+ /**
+ * Get the capacity value.
+ *
+ * @return the capacity value
+ */
+ public Long capacity() {
+ return this.capacity;
+ }
+
+ /**
+ * Set the capacity value.
+ *
+ * @param capacity the capacity value to set
+ * @return the ClusterSku object itself.
+ */
+ public ClusterSku withCapacity(Long capacity) {
+ this.capacity = capacity;
+ return this;
+ }
+
+ /**
+ * Get the name of the SKU. Possible values include: 'CapacityReservation'.
+ *
+ * @return the name value
+ */
+ public ClusterSkuNameEnum name() {
+ return this.name;
+ }
+
+ /**
+ * Set the name of the SKU. Possible values include: 'CapacityReservation'.
+ *
+ * @param name the name value to set
+ * @return the ClusterSku object itself.
+ */
+ public ClusterSku withName(ClusterSkuNameEnum name) {
+ this.name = name;
+ return this;
+ }
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterSkuNameEnum.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterSkuNameEnum.java
new file mode 100644
index 0000000000000..f65c35bf0d939
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ClusterSkuNameEnum.java
@@ -0,0 +1,38 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import java.util.Collection;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.microsoft.rest.ExpandableStringEnum;
+
+/**
+ * Defines values for ClusterSkuNameEnum.
+ */
+public final class ClusterSkuNameEnum extends ExpandableStringEnum {
+ /** Static value CapacityReservation for ClusterSkuNameEnum. */
+ public static final ClusterSkuNameEnum CAPACITY_RESERVATION = fromString("CapacityReservation");
+
+ /**
+ * Creates or finds a ClusterSkuNameEnum from its string representation.
+ * @param name a name to look for
+ * @return the corresponding ClusterSkuNameEnum
+ */
+ @JsonCreator
+ public static ClusterSkuNameEnum fromString(String name) {
+ return fromString(name, ClusterSkuNameEnum.class);
+ }
+
+ /**
+ * @return known ClusterSkuNameEnum values
+ */
+ public static Collection values() {
+ return values(ClusterSkuNameEnum.class);
+ }
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Clusters.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Clusters.java
new file mode 100644
index 0000000000000..cd3f9642d0cc5
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Clusters.java
@@ -0,0 +1,25 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.microsoft.azure.arm.collection.SupportsCreating;
+import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup;
+import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion;
+import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup;
+import rx.Observable;
+import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup;
+import com.microsoft.azure.arm.collection.SupportsListing;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.ClustersInner;
+import com.microsoft.azure.arm.model.HasInner;
+
+/**
+ * Type representing Clusters.
+ */
+public interface Clusters extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner {
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/CoreSummary.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/CoreSummary.java
new file mode 100644
index 0000000000000..dfcb88ea3bfa6
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/CoreSummary.java
@@ -0,0 +1,69 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * The core summary of a search.
+ */
+public class CoreSummary {
+ /**
+ * The status of a core summary.
+ */
+ @JsonProperty(value = "status")
+ private String status;
+
+ /**
+ * The number of documents of a core summary.
+ */
+ @JsonProperty(value = "numberOfDocuments", required = true)
+ private long numberOfDocuments;
+
+ /**
+ * Get the status of a core summary.
+ *
+ * @return the status value
+ */
+ public String status() {
+ return this.status;
+ }
+
+ /**
+ * Set the status of a core summary.
+ *
+ * @param status the status value to set
+ * @return the CoreSummary object itself.
+ */
+ public CoreSummary withStatus(String status) {
+ this.status = status;
+ return this;
+ }
+
+ /**
+ * Get the number of documents of a core summary.
+ *
+ * @return the numberOfDocuments value
+ */
+ public long numberOfDocuments() {
+ return this.numberOfDocuments;
+ }
+
+ /**
+ * Set the number of documents of a core summary.
+ *
+ * @param numberOfDocuments the numberOfDocuments value to set
+ * @return the CoreSummary object itself.
+ */
+ public CoreSummary withNumberOfDocuments(long numberOfDocuments) {
+ this.numberOfDocuments = numberOfDocuments;
+ return this;
+ }
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataExport.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataExport.java
new file mode 100644
index 0000000000000..f3c1605e7a46b
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataExport.java
@@ -0,0 +1,314 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.microsoft.azure.arm.model.HasInner;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.DataExportInner;
+import com.microsoft.azure.arm.model.Indexable;
+import com.microsoft.azure.arm.model.Refreshable;
+import com.microsoft.azure.arm.model.Updatable;
+import com.microsoft.azure.arm.model.Appliable;
+import com.microsoft.azure.arm.model.Creatable;
+import com.microsoft.azure.arm.resources.models.HasManager;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.LogAnalyticsManager;
+import java.util.List;
+
+/**
+ * Type representing DataExport.
+ */
+public interface DataExport extends HasInner, Indexable, Refreshable, Updatable, HasManager {
+ /**
+ * @return the allTables value.
+ */
+ Boolean allTables();
+
+ /**
+ * @return the createdDate value.
+ */
+ String createdDate();
+
+ /**
+ * @return the dataExportId value.
+ */
+ String dataExportId();
+
+ /**
+ * @return the dataExportType value.
+ */
+ Type dataExportType();
+
+ /**
+ * @return the enable value.
+ */
+ Boolean enable();
+
+ /**
+ * @return the eventHubName value.
+ */
+ String eventHubName();
+
+ /**
+ * @return the id value.
+ */
+ String id();
+
+ /**
+ * @return the lastModifiedDate value.
+ */
+ String lastModifiedDate();
+
+ /**
+ * @return the name value.
+ */
+ String name();
+
+ /**
+ * @return the resourceId value.
+ */
+ String resourceId();
+
+ /**
+ * @return the tableNames value.
+ */
+ List tableNames();
+
+ /**
+ * @return the type value.
+ */
+ String type();
+
+ /**
+ * The entirety of the DataExport definition.
+ */
+ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithWorkspace, DefinitionStages.WithResourceId, DefinitionStages.WithCreate {
+ }
+
+ /**
+ * Grouping of DataExport definition stages.
+ */
+ interface DefinitionStages {
+ /**
+ * The first stage of a DataExport definition.
+ */
+ interface Blank extends WithWorkspace {
+ }
+
+ /**
+ * The stage of the dataexport definition allowing to specify Workspace.
+ */
+ interface WithWorkspace {
+ /**
+ * Specifies resourceGroupName, workspaceName.
+ * @param resourceGroupName The name of the resource group. The name is case insensitive
+ * @param workspaceName The name of the workspace
+ * @return the next definition stage
+ */
+ WithResourceId withExistingWorkspace(String resourceGroupName, String workspaceName);
+ }
+
+ /**
+ * The stage of the dataexport definition allowing to specify ResourceId.
+ */
+ interface WithResourceId {
+ /**
+ * Specifies resourceId.
+ * @param resourceId The destination resource ID. This can be copied from the Properties entry of the destination resource in Azure
+ * @return the next definition stage
+ */
+ WithCreate withResourceId(String resourceId);
+ }
+
+ /**
+ * The stage of the dataexport definition allowing to specify AllTables.
+ */
+ interface WithAllTables {
+ /**
+ * Specifies allTables.
+ * @param allTables When ‘true’, all workspace's tables are exported
+ * @return the next definition stage
+ */
+ WithCreate withAllTables(Boolean allTables);
+ }
+
+ /**
+ * The stage of the dataexport definition allowing to specify CreatedDate.
+ */
+ interface WithCreatedDate {
+ /**
+ * Specifies createdDate.
+ * @param createdDate The latest data export rule modification time
+ * @return the next definition stage
+ */
+ WithCreate withCreatedDate(String createdDate);
+ }
+
+ /**
+ * The stage of the dataexport definition allowing to specify DataExportId.
+ */
+ interface WithDataExportId {
+ /**
+ * Specifies dataExportId.
+ * @param dataExportId The data export rule ID
+ * @return the next definition stage
+ */
+ WithCreate withDataExportId(String dataExportId);
+ }
+
+ /**
+ * The stage of the dataexport definition allowing to specify Enable.
+ */
+ interface WithEnable {
+ /**
+ * Specifies enable.
+ * @param enable Active when enabled
+ * @return the next definition stage
+ */
+ WithCreate withEnable(Boolean enable);
+ }
+
+ /**
+ * The stage of the dataexport definition allowing to specify EventHubName.
+ */
+ interface WithEventHubName {
+ /**
+ * Specifies eventHubName.
+ * @param eventHubName Optional. Allows to define an Event Hub name. Not applicable when destination is Storage Account
+ * @return the next definition stage
+ */
+ WithCreate withEventHubName(String eventHubName);
+ }
+
+ /**
+ * The stage of the dataexport definition allowing to specify LastModifiedDate.
+ */
+ interface WithLastModifiedDate {
+ /**
+ * Specifies lastModifiedDate.
+ * @param lastModifiedDate Date and time when the export was last modified
+ * @return the next definition stage
+ */
+ WithCreate withLastModifiedDate(String lastModifiedDate);
+ }
+
+ /**
+ * The stage of the dataexport definition allowing to specify TableNames.
+ */
+ interface WithTableNames {
+ /**
+ * Specifies tableNames.
+ * @param tableNames An array of tables to export, for example: [“Heartbeat, SecurityEvent”]
+ * @return the next definition stage
+ */
+ WithCreate withTableNames(List tableNames);
+ }
+
+ /**
+ * The stage of the definition which contains all the minimum required inputs for
+ * the resource to be created (via {@link WithCreate#create()}), but also allows
+ * for any other optional settings to be specified.
+ */
+ interface WithCreate extends Creatable, DefinitionStages.WithAllTables, DefinitionStages.WithCreatedDate, DefinitionStages.WithDataExportId, DefinitionStages.WithEnable, DefinitionStages.WithEventHubName, DefinitionStages.WithLastModifiedDate, DefinitionStages.WithTableNames {
+ }
+ }
+ /**
+ * The template for a DataExport update operation, containing all the settings that can be modified.
+ */
+ interface Update extends Appliable, UpdateStages.WithAllTables, UpdateStages.WithCreatedDate, UpdateStages.WithDataExportId, UpdateStages.WithEnable, UpdateStages.WithEventHubName, UpdateStages.WithLastModifiedDate, UpdateStages.WithTableNames {
+ }
+
+ /**
+ * Grouping of DataExport update stages.
+ */
+ interface UpdateStages {
+ /**
+ * The stage of the dataexport update allowing to specify AllTables.
+ */
+ interface WithAllTables {
+ /**
+ * Specifies allTables.
+ * @param allTables When ‘true’, all workspace's tables are exported
+ * @return the next update stage
+ */
+ Update withAllTables(Boolean allTables);
+ }
+
+ /**
+ * The stage of the dataexport update allowing to specify CreatedDate.
+ */
+ interface WithCreatedDate {
+ /**
+ * Specifies createdDate.
+ * @param createdDate The latest data export rule modification time
+ * @return the next update stage
+ */
+ Update withCreatedDate(String createdDate);
+ }
+
+ /**
+ * The stage of the dataexport update allowing to specify DataExportId.
+ */
+ interface WithDataExportId {
+ /**
+ * Specifies dataExportId.
+ * @param dataExportId The data export rule ID
+ * @return the next update stage
+ */
+ Update withDataExportId(String dataExportId);
+ }
+
+ /**
+ * The stage of the dataexport update allowing to specify Enable.
+ */
+ interface WithEnable {
+ /**
+ * Specifies enable.
+ * @param enable Active when enabled
+ * @return the next update stage
+ */
+ Update withEnable(Boolean enable);
+ }
+
+ /**
+ * The stage of the dataexport update allowing to specify EventHubName.
+ */
+ interface WithEventHubName {
+ /**
+ * Specifies eventHubName.
+ * @param eventHubName Optional. Allows to define an Event Hub name. Not applicable when destination is Storage Account
+ * @return the next update stage
+ */
+ Update withEventHubName(String eventHubName);
+ }
+
+ /**
+ * The stage of the dataexport update allowing to specify LastModifiedDate.
+ */
+ interface WithLastModifiedDate {
+ /**
+ * Specifies lastModifiedDate.
+ * @param lastModifiedDate Date and time when the export was last modified
+ * @return the next update stage
+ */
+ Update withLastModifiedDate(String lastModifiedDate);
+ }
+
+ /**
+ * The stage of the dataexport update allowing to specify TableNames.
+ */
+ interface WithTableNames {
+ /**
+ * Specifies tableNames.
+ * @param tableNames An array of tables to export, for example: [“Heartbeat, SecurityEvent”]
+ * @return the next update stage
+ */
+ Update withTableNames(List tableNames);
+ }
+
+ }
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataExportErrorResponse.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataExportErrorResponse.java
new file mode 100644
index 0000000000000..b530c44102185
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataExportErrorResponse.java
@@ -0,0 +1,44 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Error response indicates that the service is not able to process the
+ * incoming request. The reason is provided in the error message.
+ */
+public class DataExportErrorResponse {
+ /**
+ * The details of the error.
+ */
+ @JsonProperty(value = "error")
+ private ErrorResponse error;
+
+ /**
+ * Get the details of the error.
+ *
+ * @return the error value
+ */
+ public ErrorResponse error() {
+ return this.error;
+ }
+
+ /**
+ * Set the details of the error.
+ *
+ * @param error the error value to set
+ * @return the DataExportErrorResponse object itself.
+ */
+ public DataExportErrorResponse withError(ErrorResponse error) {
+ this.error = error;
+ return this;
+ }
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataExportErrorResponseException.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataExportErrorResponseException.java
new file mode 100644
index 0000000000000..18aa457d71b73
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataExportErrorResponseException.java
@@ -0,0 +1,45 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.microsoft.rest.RestException;
+import okhttp3.ResponseBody;
+import retrofit2.Response;
+
+/**
+ * Exception thrown for an invalid response with DataExportErrorResponse
+ * information.
+ */
+public class DataExportErrorResponseException extends RestException {
+ /**
+ * Initializes a new instance of the DataExportErrorResponseException class.
+ *
+ * @param message the exception message or the response content if a message is not available
+ * @param response the HTTP response
+ */
+ public DataExportErrorResponseException(final String message, final Response response) {
+ super(message, response);
+ }
+
+ /**
+ * Initializes a new instance of the DataExportErrorResponseException class.
+ *
+ * @param message the exception message or the response content if a message is not available
+ * @param response the HTTP response
+ * @param body the deserialized response body
+ */
+ public DataExportErrorResponseException(final String message, final Response response, final DataExportErrorResponse body) {
+ super(message, response, body);
+ }
+
+ @Override
+ public DataExportErrorResponse body() {
+ return (DataExportErrorResponse) super.body();
+ }
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataExports.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataExports.java
new file mode 100644
index 0000000000000..b9b6b2ec59ebc
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataExports.java
@@ -0,0 +1,53 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.microsoft.azure.arm.collection.SupportsCreating;
+import rx.Completable;
+import rx.Observable;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.DataExportsInner;
+import com.microsoft.azure.arm.model.HasInner;
+
+/**
+ * Type representing DataExports.
+ */
+public interface DataExports extends SupportsCreating, HasInner {
+ /**
+ * Gets a data export instance.
+ *
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
+ * @param workspaceName The name of the workspace.
+ * @param dataExportName The data export rule name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Observable getAsync(String resourceGroupName, String workspaceName, String dataExportName);
+
+ /**
+ * Lists the data export instances within a workspace.
+ *
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
+ * @param workspaceName The name of the workspace.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Observable listByWorkspaceAsync(String resourceGroupName, String workspaceName);
+
+ /**
+ * Deletes the specified data export in a given workspace..
+ *
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
+ * @param workspaceName The name of the workspace.
+ * @param dataExportName The data export rule name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Completable deleteAsync(String resourceGroupName, String workspaceName, String dataExportName);
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataIngestionStatus.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataIngestionStatus.java
new file mode 100644
index 0000000000000..f306c2fdefdec
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataIngestionStatus.java
@@ -0,0 +1,53 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import java.util.Collection;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.microsoft.rest.ExpandableStringEnum;
+
+/**
+ * Defines values for DataIngestionStatus.
+ */
+public final class DataIngestionStatus extends ExpandableStringEnum {
+ /** Static value RespectQuota for DataIngestionStatus. */
+ public static final DataIngestionStatus RESPECT_QUOTA = fromString("RespectQuota");
+
+ /** Static value ForceOn for DataIngestionStatus. */
+ public static final DataIngestionStatus FORCE_ON = fromString("ForceOn");
+
+ /** Static value ForceOff for DataIngestionStatus. */
+ public static final DataIngestionStatus FORCE_OFF = fromString("ForceOff");
+
+ /** Static value OverQuota for DataIngestionStatus. */
+ public static final DataIngestionStatus OVER_QUOTA = fromString("OverQuota");
+
+ /** Static value SubscriptionSuspended for DataIngestionStatus. */
+ public static final DataIngestionStatus SUBSCRIPTION_SUSPENDED = fromString("SubscriptionSuspended");
+
+ /** Static value ApproachingQuota for DataIngestionStatus. */
+ public static final DataIngestionStatus APPROACHING_QUOTA = fromString("ApproachingQuota");
+
+ /**
+ * Creates or finds a DataIngestionStatus from its string representation.
+ * @param name a name to look for
+ * @return the corresponding DataIngestionStatus
+ */
+ @JsonCreator
+ public static DataIngestionStatus fromString(String name) {
+ return fromString(name, DataIngestionStatus.class);
+ }
+
+ /**
+ * @return known DataIngestionStatus values
+ */
+ public static Collection values() {
+ return values(DataIngestionStatus.class);
+ }
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSource.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSource.java
new file mode 100644
index 0000000000000..f0e0f1ae6e7e4
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSource.java
@@ -0,0 +1,181 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.microsoft.azure.arm.model.HasInner;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.DataSourceInner;
+import com.microsoft.azure.arm.model.Indexable;
+import com.microsoft.azure.arm.model.Refreshable;
+import com.microsoft.azure.arm.model.Updatable;
+import com.microsoft.azure.arm.model.Appliable;
+import com.microsoft.azure.arm.model.Creatable;
+import com.microsoft.azure.arm.resources.models.HasManager;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.LogAnalyticsManager;
+import java.util.Map;
+
+/**
+ * Type representing DataSource.
+ */
+public interface DataSource extends HasInner, Indexable, Refreshable, Updatable, HasManager {
+ /**
+ * @return the etag value.
+ */
+ String etag();
+
+ /**
+ * @return the id value.
+ */
+ String id();
+
+ /**
+ * @return the kind value.
+ */
+ DataSourceKind kind();
+
+ /**
+ * @return the name value.
+ */
+ String name();
+
+ /**
+ * @return the properties value.
+ */
+ Object properties();
+
+ /**
+ * @return the tags value.
+ */
+ Map tags();
+
+ /**
+ * @return the type value.
+ */
+ String type();
+
+ /**
+ * The entirety of the DataSource definition.
+ */
+ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithWorkspace, DefinitionStages.WithKind, DefinitionStages.WithProperties, DefinitionStages.WithCreate {
+ }
+
+ /**
+ * Grouping of DataSource definition stages.
+ */
+ interface DefinitionStages {
+ /**
+ * The first stage of a DataSource definition.
+ */
+ interface Blank extends WithWorkspace {
+ }
+
+ /**
+ * The stage of the datasource definition allowing to specify Workspace.
+ */
+ interface WithWorkspace {
+ /**
+ * Specifies resourceGroupName, workspaceName.
+ * @param resourceGroupName The name of the resource group. The name is case insensitive
+ * @param workspaceName The name of the workspace
+ * @return the next definition stage
+ */
+ WithKind withExistingWorkspace(String resourceGroupName, String workspaceName);
+ }
+
+ /**
+ * The stage of the datasource definition allowing to specify Kind.
+ */
+ interface WithKind {
+ /**
+ * Specifies kind.
+ * @param kind Possible values include: 'WindowsEvent', 'WindowsPerformanceCounter', 'IISLogs', 'LinuxSyslog', 'LinuxSyslogCollection', 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'CustomLog', 'CustomLogCollection', 'AzureAuditLog', 'AzureActivityLog', 'GenericDataSource', 'ChangeTrackingCustomPath', 'ChangeTrackingPath', 'ChangeTrackingServices', 'ChangeTrackingDataTypeConfiguration', 'ChangeTrackingDefaultRegistry', 'ChangeTrackingRegistry', 'ChangeTrackingLinuxPath', 'LinuxChangeTrackingPath', 'ChangeTrackingContentLocation', 'WindowsTelemetry', 'Office365', 'SecurityWindowsBaselineConfiguration', 'SecurityCenterSecurityWindowsBaselineConfiguration', 'SecurityEventCollectionConfiguration', 'SecurityInsightsSecurityEventCollectionConfiguration', 'ImportComputerGroup', 'NetworkMonitoring', 'Itsm', 'DnsAnalytics', 'ApplicationInsights', 'SqlDataClassification'
+ * @return the next definition stage
+ */
+ WithProperties withKind(DataSourceKind kind);
+ }
+
+ /**
+ * The stage of the datasource definition allowing to specify Properties.
+ */
+ interface WithProperties {
+ /**
+ * Specifies properties.
+ * @param properties The data source properties in raw json format, each kind of data source have it's own schema
+ * @return the next definition stage
+ */
+ WithCreate withProperties(Object properties);
+ }
+
+ /**
+ * The stage of the datasource definition allowing to specify Etag.
+ */
+ interface WithEtag {
+ /**
+ * Specifies etag.
+ * @param etag The ETag of the data source
+ * @return the next definition stage
+ */
+ WithCreate withEtag(String etag);
+ }
+
+ /**
+ * The stage of the datasource definition allowing to specify Tags.
+ */
+ interface WithTags {
+ /**
+ * Specifies tags.
+ * @param tags Resource tags
+ * @return the next definition stage
+ */
+ WithCreate withTags(Map tags);
+ }
+
+ /**
+ * The stage of the definition which contains all the minimum required inputs for
+ * the resource to be created (via {@link WithCreate#create()}), but also allows
+ * for any other optional settings to be specified.
+ */
+ interface WithCreate extends Creatable, DefinitionStages.WithEtag, DefinitionStages.WithTags {
+ }
+ }
+ /**
+ * The template for a DataSource update operation, containing all the settings that can be modified.
+ */
+ interface Update extends Appliable, UpdateStages.WithEtag, UpdateStages.WithTags {
+ }
+
+ /**
+ * Grouping of DataSource update stages.
+ */
+ interface UpdateStages {
+ /**
+ * The stage of the datasource update allowing to specify Etag.
+ */
+ interface WithEtag {
+ /**
+ * Specifies etag.
+ * @param etag The ETag of the data source
+ * @return the next update stage
+ */
+ Update withEtag(String etag);
+ }
+
+ /**
+ * The stage of the datasource update allowing to specify Tags.
+ */
+ interface WithTags {
+ /**
+ * Specifies tags.
+ * @param tags Resource tags
+ * @return the next update stage
+ */
+ Update withTags(Map tags);
+ }
+
+ }
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSourceFilter.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSourceFilter.java
new file mode 100644
index 0000000000000..231091883ae61
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSourceFilter.java
@@ -0,0 +1,57 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * DataSource filter. Right now, only filter by kind is supported.
+ */
+public class DataSourceFilter {
+ /**
+ * Possible values include: 'WindowsEvent', 'WindowsPerformanceCounter',
+ * 'IISLogs', 'LinuxSyslog', 'LinuxSyslogCollection',
+ * 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'CustomLog',
+ * 'CustomLogCollection', 'AzureAuditLog', 'AzureActivityLog',
+ * 'GenericDataSource', 'ChangeTrackingCustomPath', 'ChangeTrackingPath',
+ * 'ChangeTrackingServices', 'ChangeTrackingDataTypeConfiguration',
+ * 'ChangeTrackingDefaultRegistry', 'ChangeTrackingRegistry',
+ * 'ChangeTrackingLinuxPath', 'LinuxChangeTrackingPath',
+ * 'ChangeTrackingContentLocation', 'WindowsTelemetry', 'Office365',
+ * 'SecurityWindowsBaselineConfiguration',
+ * 'SecurityCenterSecurityWindowsBaselineConfiguration',
+ * 'SecurityEventCollectionConfiguration',
+ * 'SecurityInsightsSecurityEventCollectionConfiguration',
+ * 'ImportComputerGroup', 'NetworkMonitoring', 'Itsm', 'DnsAnalytics',
+ * 'ApplicationInsights', 'SqlDataClassification'.
+ */
+ @JsonProperty(value = "kind")
+ private DataSourceKind kind;
+
+ /**
+ * Get possible values include: 'WindowsEvent', 'WindowsPerformanceCounter', 'IISLogs', 'LinuxSyslog', 'LinuxSyslogCollection', 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'CustomLog', 'CustomLogCollection', 'AzureAuditLog', 'AzureActivityLog', 'GenericDataSource', 'ChangeTrackingCustomPath', 'ChangeTrackingPath', 'ChangeTrackingServices', 'ChangeTrackingDataTypeConfiguration', 'ChangeTrackingDefaultRegistry', 'ChangeTrackingRegistry', 'ChangeTrackingLinuxPath', 'LinuxChangeTrackingPath', 'ChangeTrackingContentLocation', 'WindowsTelemetry', 'Office365', 'SecurityWindowsBaselineConfiguration', 'SecurityCenterSecurityWindowsBaselineConfiguration', 'SecurityEventCollectionConfiguration', 'SecurityInsightsSecurityEventCollectionConfiguration', 'ImportComputerGroup', 'NetworkMonitoring', 'Itsm', 'DnsAnalytics', 'ApplicationInsights', 'SqlDataClassification'.
+ *
+ * @return the kind value
+ */
+ public DataSourceKind kind() {
+ return this.kind;
+ }
+
+ /**
+ * Set possible values include: 'WindowsEvent', 'WindowsPerformanceCounter', 'IISLogs', 'LinuxSyslog', 'LinuxSyslogCollection', 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'CustomLog', 'CustomLogCollection', 'AzureAuditLog', 'AzureActivityLog', 'GenericDataSource', 'ChangeTrackingCustomPath', 'ChangeTrackingPath', 'ChangeTrackingServices', 'ChangeTrackingDataTypeConfiguration', 'ChangeTrackingDefaultRegistry', 'ChangeTrackingRegistry', 'ChangeTrackingLinuxPath', 'LinuxChangeTrackingPath', 'ChangeTrackingContentLocation', 'WindowsTelemetry', 'Office365', 'SecurityWindowsBaselineConfiguration', 'SecurityCenterSecurityWindowsBaselineConfiguration', 'SecurityEventCollectionConfiguration', 'SecurityInsightsSecurityEventCollectionConfiguration', 'ImportComputerGroup', 'NetworkMonitoring', 'Itsm', 'DnsAnalytics', 'ApplicationInsights', 'SqlDataClassification'.
+ *
+ * @param kind the kind value to set
+ * @return the DataSourceFilter object itself.
+ */
+ public DataSourceFilter withKind(DataSourceKind kind) {
+ this.kind = kind;
+ return this;
+ }
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSourceKind.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSourceKind.java
new file mode 100644
index 0000000000000..12328aa5a3c5f
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSourceKind.java
@@ -0,0 +1,134 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import java.util.Collection;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.microsoft.rest.ExpandableStringEnum;
+
+/**
+ * Defines values for DataSourceKind.
+ */
+public final class DataSourceKind extends ExpandableStringEnum {
+ /** Static value WindowsEvent for DataSourceKind. */
+ public static final DataSourceKind WINDOWS_EVENT = fromString("WindowsEvent");
+
+ /** Static value WindowsPerformanceCounter for DataSourceKind. */
+ public static final DataSourceKind WINDOWS_PERFORMANCE_COUNTER = fromString("WindowsPerformanceCounter");
+
+ /** Static value IISLogs for DataSourceKind. */
+ public static final DataSourceKind IISLOGS = fromString("IISLogs");
+
+ /** Static value LinuxSyslog for DataSourceKind. */
+ public static final DataSourceKind LINUX_SYSLOG = fromString("LinuxSyslog");
+
+ /** Static value LinuxSyslogCollection for DataSourceKind. */
+ public static final DataSourceKind LINUX_SYSLOG_COLLECTION = fromString("LinuxSyslogCollection");
+
+ /** Static value LinuxPerformanceObject for DataSourceKind. */
+ public static final DataSourceKind LINUX_PERFORMANCE_OBJECT = fromString("LinuxPerformanceObject");
+
+ /** Static value LinuxPerformanceCollection for DataSourceKind. */
+ public static final DataSourceKind LINUX_PERFORMANCE_COLLECTION = fromString("LinuxPerformanceCollection");
+
+ /** Static value CustomLog for DataSourceKind. */
+ public static final DataSourceKind CUSTOM_LOG = fromString("CustomLog");
+
+ /** Static value CustomLogCollection for DataSourceKind. */
+ public static final DataSourceKind CUSTOM_LOG_COLLECTION = fromString("CustomLogCollection");
+
+ /** Static value AzureAuditLog for DataSourceKind. */
+ public static final DataSourceKind AZURE_AUDIT_LOG = fromString("AzureAuditLog");
+
+ /** Static value AzureActivityLog for DataSourceKind. */
+ public static final DataSourceKind AZURE_ACTIVITY_LOG = fromString("AzureActivityLog");
+
+ /** Static value GenericDataSource for DataSourceKind. */
+ public static final DataSourceKind GENERIC_DATA_SOURCE = fromString("GenericDataSource");
+
+ /** Static value ChangeTrackingCustomPath for DataSourceKind. */
+ public static final DataSourceKind CHANGE_TRACKING_CUSTOM_PATH = fromString("ChangeTrackingCustomPath");
+
+ /** Static value ChangeTrackingPath for DataSourceKind. */
+ public static final DataSourceKind CHANGE_TRACKING_PATH = fromString("ChangeTrackingPath");
+
+ /** Static value ChangeTrackingServices for DataSourceKind. */
+ public static final DataSourceKind CHANGE_TRACKING_SERVICES = fromString("ChangeTrackingServices");
+
+ /** Static value ChangeTrackingDataTypeConfiguration for DataSourceKind. */
+ public static final DataSourceKind CHANGE_TRACKING_DATA_TYPE_CONFIGURATION = fromString("ChangeTrackingDataTypeConfiguration");
+
+ /** Static value ChangeTrackingDefaultRegistry for DataSourceKind. */
+ public static final DataSourceKind CHANGE_TRACKING_DEFAULT_REGISTRY = fromString("ChangeTrackingDefaultRegistry");
+
+ /** Static value ChangeTrackingRegistry for DataSourceKind. */
+ public static final DataSourceKind CHANGE_TRACKING_REGISTRY = fromString("ChangeTrackingRegistry");
+
+ /** Static value ChangeTrackingLinuxPath for DataSourceKind. */
+ public static final DataSourceKind CHANGE_TRACKING_LINUX_PATH = fromString("ChangeTrackingLinuxPath");
+
+ /** Static value LinuxChangeTrackingPath for DataSourceKind. */
+ public static final DataSourceKind LINUX_CHANGE_TRACKING_PATH = fromString("LinuxChangeTrackingPath");
+
+ /** Static value ChangeTrackingContentLocation for DataSourceKind. */
+ public static final DataSourceKind CHANGE_TRACKING_CONTENT_LOCATION = fromString("ChangeTrackingContentLocation");
+
+ /** Static value WindowsTelemetry for DataSourceKind. */
+ public static final DataSourceKind WINDOWS_TELEMETRY = fromString("WindowsTelemetry");
+
+ /** Static value Office365 for DataSourceKind. */
+ public static final DataSourceKind OFFICE365 = fromString("Office365");
+
+ /** Static value SecurityWindowsBaselineConfiguration for DataSourceKind. */
+ public static final DataSourceKind SECURITY_WINDOWS_BASELINE_CONFIGURATION = fromString("SecurityWindowsBaselineConfiguration");
+
+ /** Static value SecurityCenterSecurityWindowsBaselineConfiguration for DataSourceKind. */
+ public static final DataSourceKind SECURITY_CENTER_SECURITY_WINDOWS_BASELINE_CONFIGURATION = fromString("SecurityCenterSecurityWindowsBaselineConfiguration");
+
+ /** Static value SecurityEventCollectionConfiguration for DataSourceKind. */
+ public static final DataSourceKind SECURITY_EVENT_COLLECTION_CONFIGURATION = fromString("SecurityEventCollectionConfiguration");
+
+ /** Static value SecurityInsightsSecurityEventCollectionConfiguration for DataSourceKind. */
+ public static final DataSourceKind SECURITY_INSIGHTS_SECURITY_EVENT_COLLECTION_CONFIGURATION = fromString("SecurityInsightsSecurityEventCollectionConfiguration");
+
+ /** Static value ImportComputerGroup for DataSourceKind. */
+ public static final DataSourceKind IMPORT_COMPUTER_GROUP = fromString("ImportComputerGroup");
+
+ /** Static value NetworkMonitoring for DataSourceKind. */
+ public static final DataSourceKind NETWORK_MONITORING = fromString("NetworkMonitoring");
+
+ /** Static value Itsm for DataSourceKind. */
+ public static final DataSourceKind ITSM = fromString("Itsm");
+
+ /** Static value DnsAnalytics for DataSourceKind. */
+ public static final DataSourceKind DNS_ANALYTICS = fromString("DnsAnalytics");
+
+ /** Static value ApplicationInsights for DataSourceKind. */
+ public static final DataSourceKind APPLICATION_INSIGHTS = fromString("ApplicationInsights");
+
+ /** Static value SqlDataClassification for DataSourceKind. */
+ public static final DataSourceKind SQL_DATA_CLASSIFICATION = fromString("SqlDataClassification");
+
+ /**
+ * Creates or finds a DataSourceKind from its string representation.
+ * @param name a name to look for
+ * @return the corresponding DataSourceKind
+ */
+ @JsonCreator
+ public static DataSourceKind fromString(String name) {
+ return fromString(name, DataSourceKind.class);
+ }
+
+ /**
+ * @return known DataSourceKind values
+ */
+ public static Collection values() {
+ return values(DataSourceKind.class);
+ }
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSourceType.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSourceType.java
new file mode 100644
index 0000000000000..b1ea7c7d1236c
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSourceType.java
@@ -0,0 +1,59 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+/**
+ * Defines values for DataSourceType.
+ */
+public enum DataSourceType {
+ /** Enum value CustomLogs. */
+ CUSTOM_LOGS("CustomLogs"),
+
+ /** Enum value AzureWatson. */
+ AZURE_WATSON("AzureWatson"),
+
+ /** Enum value Query. */
+ QUERY("Query"),
+
+ /** Enum value Alerts. */
+ ALERTS("Alerts");
+
+ /** The actual serialized value for a DataSourceType instance. */
+ private String value;
+
+ DataSourceType(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Parses a serialized value to a DataSourceType instance.
+ *
+ * @param value the serialized value to parse.
+ * @return the parsed DataSourceType object, or null if unable to parse.
+ */
+ @JsonCreator
+ public static DataSourceType fromString(String value) {
+ DataSourceType[] items = DataSourceType.values();
+ for (DataSourceType item : items) {
+ if (item.toString().equalsIgnoreCase(value)) {
+ return item;
+ }
+ }
+ return null;
+ }
+
+ @JsonValue
+ @Override
+ public String toString() {
+ return this.value;
+ }
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSources.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSources.java
new file mode 100644
index 0000000000000..dcd3518f39796
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DataSources.java
@@ -0,0 +1,54 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.microsoft.azure.arm.collection.SupportsCreating;
+import rx.Completable;
+import rx.Observable;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.DataSourcesInner;
+import com.microsoft.azure.arm.model.HasInner;
+
+/**
+ * Type representing DataSources.
+ */
+public interface DataSources extends SupportsCreating, HasInner {
+ /**
+ * Gets a datasource instance.
+ *
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
+ * @param workspaceName The name of the workspace.
+ * @param dataSourceName Name of the datasource
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Observable getAsync(String resourceGroupName, String workspaceName, String dataSourceName);
+
+ /**
+ * Gets the first page of data source instances in a workspace with the link to the next page.
+ *
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
+ * @param workspaceName The name of the workspace.
+ * @param filter The filter to apply on the operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Observable listByWorkspaceAsync(final String resourceGroupName, final String workspaceName, final String filter);
+
+ /**
+ * Deletes a data source instance.
+ *
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
+ * @param workspaceName The name of the workspace.
+ * @param dataSourceName Name of the datasource.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Completable deleteAsync(String resourceGroupName, String workspaceName, String dataSourceName);
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DeletedWorkspaces.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DeletedWorkspaces.java
new file mode 100644
index 0000000000000..2d94e44d803ef
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/DeletedWorkspaces.java
@@ -0,0 +1,20 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup;
+import com.microsoft.azure.arm.collection.SupportsListing;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.DeletedWorkspacesInner;
+import com.microsoft.azure.arm.model.HasInner;
+
+/**
+ * Type representing DeletedWorkspaces.
+ */
+public interface DeletedWorkspaces extends SupportsListingByResourceGroup, SupportsListing, HasInner {
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ErrorAdditionalInfo.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ErrorAdditionalInfo.java
new file mode 100644
index 0000000000000..38b8736aaf902
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ErrorAdditionalInfo.java
@@ -0,0 +1,47 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * The resource management error additional info.
+ */
+public class ErrorAdditionalInfo {
+ /**
+ * The additional info type.
+ */
+ @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY)
+ private String type;
+
+ /**
+ * The additional info.
+ */
+ @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY)
+ private Object info;
+
+ /**
+ * Get the additional info type.
+ *
+ * @return the type value
+ */
+ public String type() {
+ return this.type;
+ }
+
+ /**
+ * Get the additional info.
+ *
+ * @return the info value
+ */
+ public Object info() {
+ return this.info;
+ }
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ErrorContract.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ErrorContract.java
new file mode 100644
index 0000000000000..a81b8365247ac
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ErrorContract.java
@@ -0,0 +1,44 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Error details.
+ * Contains details when the response code indicates an error.
+ */
+public class ErrorContract {
+ /**
+ * The details of the error.
+ */
+ @JsonProperty(value = "error")
+ private ErrorResponse error;
+
+ /**
+ * Get the details of the error.
+ *
+ * @return the error value
+ */
+ public ErrorResponse error() {
+ return this.error;
+ }
+
+ /**
+ * Set the details of the error.
+ *
+ * @param error the error value to set
+ * @return the ErrorContract object itself.
+ */
+ public ErrorContract withError(ErrorResponse error) {
+ this.error = error;
+ return this;
+ }
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ErrorContractException.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ErrorContractException.java
new file mode 100644
index 0000000000000..968146946a3d7
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ErrorContractException.java
@@ -0,0 +1,44 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.microsoft.rest.RestException;
+import okhttp3.ResponseBody;
+import retrofit2.Response;
+
+/**
+ * Exception thrown for an invalid response with ErrorContract information.
+ */
+public class ErrorContractException extends RestException {
+ /**
+ * Initializes a new instance of the ErrorContractException class.
+ *
+ * @param message the exception message or the response content if a message is not available
+ * @param response the HTTP response
+ */
+ public ErrorContractException(final String message, final Response response) {
+ super(message, response);
+ }
+
+ /**
+ * Initializes a new instance of the ErrorContractException class.
+ *
+ * @param message the exception message or the response content if a message is not available
+ * @param response the HTTP response
+ * @param body the deserialized response body
+ */
+ public ErrorContractException(final String message, final Response response, final ErrorContract body) {
+ super(message, response, body);
+ }
+
+ @Override
+ public ErrorContract body() {
+ return (ErrorContract) super.body();
+ }
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ErrorResponse.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ErrorResponse.java
new file mode 100644
index 0000000000000..46b32585ea601
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/ErrorResponse.java
@@ -0,0 +1,93 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * The resource management error response.
+ */
+public class ErrorResponse {
+ /**
+ * The error code.
+ */
+ @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY)
+ private String code;
+
+ /**
+ * The error message.
+ */
+ @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY)
+ private String message;
+
+ /**
+ * The error target.
+ */
+ @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY)
+ private String target;
+
+ /**
+ * The error details.
+ */
+ @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY)
+ private List details;
+
+ /**
+ * The error additional info.
+ */
+ @JsonProperty(value = "additionalInfo", access = JsonProperty.Access.WRITE_ONLY)
+ private List additionalInfo;
+
+ /**
+ * Get the error code.
+ *
+ * @return the code value
+ */
+ public String code() {
+ return this.code;
+ }
+
+ /**
+ * Get the error message.
+ *
+ * @return the message value
+ */
+ public String message() {
+ return this.message;
+ }
+
+ /**
+ * Get the error target.
+ *
+ * @return the target value
+ */
+ public String target() {
+ return this.target;
+ }
+
+ /**
+ * Get the error details.
+ *
+ * @return the details value
+ */
+ public List details() {
+ return this.details;
+ }
+
+ /**
+ * Get the error additional info.
+ *
+ * @return the additionalInfo value
+ */
+ public List additionalInfo() {
+ return this.additionalInfo;
+ }
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Gateways.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Gateways.java
new file mode 100644
index 0000000000000..2732ef2aa0d88
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Gateways.java
@@ -0,0 +1,30 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import rx.Completable;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.GatewaysInner;
+import com.microsoft.azure.arm.model.HasInner;
+
+/**
+ * Type representing Gateways.
+ */
+public interface Gateways extends HasInner {
+ /**
+ * Delete a Log Analytics gateway.
+ *
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
+ * @param workspaceName The name of the workspace.
+ * @param gatewayId The Log Analytics gateway Id.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Completable deleteAsync(String resourceGroupName, String workspaceName, String gatewayId);
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Identity.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Identity.java
new file mode 100644
index 0000000000000..f234af43c6aaa
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/Identity.java
@@ -0,0 +1,73 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Identity for the resource.
+ */
+public class Identity {
+ /**
+ * The principal ID of resource identity.
+ */
+ @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY)
+ private String principalId;
+
+ /**
+ * The tenant ID of resource.
+ */
+ @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY)
+ private String tenantId;
+
+ /**
+ * The identity type. Possible values include: 'SystemAssigned', 'None'.
+ */
+ @JsonProperty(value = "type", required = true)
+ private IdentityType type;
+
+ /**
+ * Get the principal ID of resource identity.
+ *
+ * @return the principalId value
+ */
+ public String principalId() {
+ return this.principalId;
+ }
+
+ /**
+ * Get the tenant ID of resource.
+ *
+ * @return the tenantId value
+ */
+ public String tenantId() {
+ return this.tenantId;
+ }
+
+ /**
+ * Get the identity type. Possible values include: 'SystemAssigned', 'None'.
+ *
+ * @return the type value
+ */
+ public IdentityType type() {
+ return this.type;
+ }
+
+ /**
+ * Set the identity type. Possible values include: 'SystemAssigned', 'None'.
+ *
+ * @param type the type value to set
+ * @return the Identity object itself.
+ */
+ public Identity withType(IdentityType type) {
+ this.type = type;
+ return this;
+ }
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/IdentityType.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/IdentityType.java
new file mode 100644
index 0000000000000..f1e8bb01b25c7
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/IdentityType.java
@@ -0,0 +1,53 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+/**
+ * Defines values for IdentityType.
+ */
+public enum IdentityType {
+ /** Enum value SystemAssigned. */
+ SYSTEM_ASSIGNED("SystemAssigned"),
+
+ /** Enum value None. */
+ NONE("None");
+
+ /** The actual serialized value for a IdentityType instance. */
+ private String value;
+
+ IdentityType(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Parses a serialized value to a IdentityType instance.
+ *
+ * @param value the serialized value to parse.
+ * @return the parsed IdentityType object, or null if unable to parse.
+ */
+ @JsonCreator
+ public static IdentityType fromString(String value) {
+ IdentityType[] items = IdentityType.values();
+ for (IdentityType item : items) {
+ if (item.toString().equalsIgnoreCase(value)) {
+ return item;
+ }
+ }
+ return null;
+ }
+
+ @JsonValue
+ @Override
+ public String toString() {
+ return this.value;
+ }
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/IntelligencePack.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/IntelligencePack.java
new file mode 100644
index 0000000000000..6593d1bdf9ff8
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/IntelligencePack.java
@@ -0,0 +1,35 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.microsoft.azure.arm.model.HasInner;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.IntelligencePackInner;
+import com.microsoft.azure.arm.resources.models.HasManager;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.LogAnalyticsManager;
+
+/**
+ * Type representing IntelligencePack.
+ */
+public interface IntelligencePack extends HasInner, HasManager {
+ /**
+ * @return the displayName value.
+ */
+ String displayName();
+
+ /**
+ * @return the enabled value.
+ */
+ Boolean enabled();
+
+ /**
+ * @return the name value.
+ */
+ String name();
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/IntelligencePacks.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/IntelligencePacks.java
new file mode 100644
index 0000000000000..9a63a0b65dfff
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/IntelligencePacks.java
@@ -0,0 +1,52 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import rx.Observable;
+import rx.Completable;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.IntelligencePacksInner;
+import com.microsoft.azure.arm.model.HasInner;
+
+/**
+ * Type representing IntelligencePacks.
+ */
+public interface IntelligencePacks extends HasInner {
+ /**
+ * Disables an intelligence pack for a given workspace.
+ *
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
+ * @param workspaceName The name of the workspace.
+ * @param intelligencePackName The name of the intelligence pack to be disabled.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Completable disableAsync(String resourceGroupName, String workspaceName, String intelligencePackName);
+
+ /**
+ * Enables an intelligence pack for a given workspace.
+ *
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
+ * @param workspaceName The name of the workspace.
+ * @param intelligencePackName The name of the intelligence pack to be enabled.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Completable enableAsync(String resourceGroupName, String workspaceName, String intelligencePackName);
+
+ /**
+ * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace.
+ *
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
+ * @param workspaceName The name of the workspace.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Observable listAsync(String resourceGroupName, String workspaceName);
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/KeyVaultProperties.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/KeyVaultProperties.java
new file mode 100644
index 0000000000000..78e0b0164b727
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/KeyVaultProperties.java
@@ -0,0 +1,96 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * The key vault properties.
+ */
+public class KeyVaultProperties {
+ /**
+ * The Key Vault uri which holds they key associated with the Log Analytics
+ * cluster.
+ */
+ @JsonProperty(value = "keyVaultUri")
+ private String keyVaultUri;
+
+ /**
+ * The name of the key associated with the Log Analytics cluster.
+ */
+ @JsonProperty(value = "keyName")
+ private String keyName;
+
+ /**
+ * The version of the key associated with the Log Analytics cluster.
+ */
+ @JsonProperty(value = "keyVersion")
+ private String keyVersion;
+
+ /**
+ * Get the Key Vault uri which holds they key associated with the Log Analytics cluster.
+ *
+ * @return the keyVaultUri value
+ */
+ public String keyVaultUri() {
+ return this.keyVaultUri;
+ }
+
+ /**
+ * Set the Key Vault uri which holds they key associated with the Log Analytics cluster.
+ *
+ * @param keyVaultUri the keyVaultUri value to set
+ * @return the KeyVaultProperties object itself.
+ */
+ public KeyVaultProperties withKeyVaultUri(String keyVaultUri) {
+ this.keyVaultUri = keyVaultUri;
+ return this;
+ }
+
+ /**
+ * Get the name of the key associated with the Log Analytics cluster.
+ *
+ * @return the keyName value
+ */
+ public String keyName() {
+ return this.keyName;
+ }
+
+ /**
+ * Set the name of the key associated with the Log Analytics cluster.
+ *
+ * @param keyName the keyName value to set
+ * @return the KeyVaultProperties object itself.
+ */
+ public KeyVaultProperties withKeyName(String keyName) {
+ this.keyName = keyName;
+ return this;
+ }
+
+ /**
+ * Get the version of the key associated with the Log Analytics cluster.
+ *
+ * @return the keyVersion value
+ */
+ public String keyVersion() {
+ return this.keyVersion;
+ }
+
+ /**
+ * Set the version of the key associated with the Log Analytics cluster.
+ *
+ * @param keyVersion the keyVersion value to set
+ * @return the KeyVaultProperties object itself.
+ */
+ public KeyVaultProperties withKeyVersion(String keyVersion) {
+ this.keyVersion = keyVersion;
+ return this;
+ }
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/LinkedService.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/LinkedService.java
new file mode 100644
index 0000000000000..31100d0c44eb6
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/LinkedService.java
@@ -0,0 +1,205 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.microsoft.azure.arm.model.HasInner;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.LinkedServiceInner;
+import com.microsoft.azure.arm.model.Indexable;
+import com.microsoft.azure.arm.model.Refreshable;
+import com.microsoft.azure.arm.model.Updatable;
+import com.microsoft.azure.arm.model.Appliable;
+import com.microsoft.azure.arm.model.Creatable;
+import com.microsoft.azure.arm.resources.models.HasManager;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.LogAnalyticsManager;
+import java.util.Map;
+
+/**
+ * Type representing LinkedService.
+ */
+public interface LinkedService extends HasInner, Indexable, Refreshable, Updatable, HasManager {
+ /**
+ * @return the id value.
+ */
+ String id();
+
+ /**
+ * @return the name value.
+ */
+ String name();
+
+ /**
+ * @return the provisioningState value.
+ */
+ LinkedServiceEntityStatus provisioningState();
+
+ /**
+ * @return the resourceId value.
+ */
+ String resourceId();
+
+ /**
+ * @return the tags value.
+ */
+ Map tags();
+
+ /**
+ * @return the type value.
+ */
+ String type();
+
+ /**
+ * @return the writeAccessResourceId value.
+ */
+ String writeAccessResourceId();
+
+ /**
+ * The entirety of the LinkedService definition.
+ */
+ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithWorkspace, DefinitionStages.WithCreate {
+ }
+
+ /**
+ * Grouping of LinkedService definition stages.
+ */
+ interface DefinitionStages {
+ /**
+ * The first stage of a LinkedService definition.
+ */
+ interface Blank extends WithWorkspace {
+ }
+
+ /**
+ * The stage of the linkedservice definition allowing to specify Workspace.
+ */
+ interface WithWorkspace {
+ /**
+ * Specifies resourceGroupName, workspaceName.
+ * @param resourceGroupName The name of the resource group. The name is case insensitive
+ * @param workspaceName The name of the workspace
+ * @return the next definition stage
+ */
+ WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName);
+ }
+
+ /**
+ * The stage of the linkedservice definition allowing to specify ProvisioningState.
+ */
+ interface WithProvisioningState {
+ /**
+ * Specifies provisioningState.
+ * @param provisioningState The provisioning state of the linked service. Possible values include: 'Succeeded', 'Deleting', 'ProvisioningAccount', 'Updating'
+ * @return the next definition stage
+ */
+ WithCreate withProvisioningState(LinkedServiceEntityStatus provisioningState);
+ }
+
+ /**
+ * The stage of the linkedservice definition allowing to specify ResourceId.
+ */
+ interface WithResourceId {
+ /**
+ * Specifies resourceId.
+ * @param resourceId The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require read access
+ * @return the next definition stage
+ */
+ WithCreate withResourceId(String resourceId);
+ }
+
+ /**
+ * The stage of the linkedservice definition allowing to specify Tags.
+ */
+ interface WithTags {
+ /**
+ * Specifies tags.
+ * @param tags Resource tags
+ * @return the next definition stage
+ */
+ WithCreate withTags(Map tags);
+ }
+
+ /**
+ * The stage of the linkedservice definition allowing to specify WriteAccessResourceId.
+ */
+ interface WithWriteAccessResourceId {
+ /**
+ * Specifies writeAccessResourceId.
+ * @param writeAccessResourceId The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require write access
+ * @return the next definition stage
+ */
+ WithCreate withWriteAccessResourceId(String writeAccessResourceId);
+ }
+
+ /**
+ * The stage of the definition which contains all the minimum required inputs for
+ * the resource to be created (via {@link WithCreate#create()}), but also allows
+ * for any other optional settings to be specified.
+ */
+ interface WithCreate extends Creatable, DefinitionStages.WithProvisioningState, DefinitionStages.WithResourceId, DefinitionStages.WithTags, DefinitionStages.WithWriteAccessResourceId {
+ }
+ }
+ /**
+ * The template for a LinkedService update operation, containing all the settings that can be modified.
+ */
+ interface Update extends Appliable, UpdateStages.WithProvisioningState, UpdateStages.WithResourceId, UpdateStages.WithTags, UpdateStages.WithWriteAccessResourceId {
+ }
+
+ /**
+ * Grouping of LinkedService update stages.
+ */
+ interface UpdateStages {
+ /**
+ * The stage of the linkedservice update allowing to specify ProvisioningState.
+ */
+ interface WithProvisioningState {
+ /**
+ * Specifies provisioningState.
+ * @param provisioningState The provisioning state of the linked service. Possible values include: 'Succeeded', 'Deleting', 'ProvisioningAccount', 'Updating'
+ * @return the next update stage
+ */
+ Update withProvisioningState(LinkedServiceEntityStatus provisioningState);
+ }
+
+ /**
+ * The stage of the linkedservice update allowing to specify ResourceId.
+ */
+ interface WithResourceId {
+ /**
+ * Specifies resourceId.
+ * @param resourceId The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require read access
+ * @return the next update stage
+ */
+ Update withResourceId(String resourceId);
+ }
+
+ /**
+ * The stage of the linkedservice update allowing to specify Tags.
+ */
+ interface WithTags {
+ /**
+ * Specifies tags.
+ * @param tags Resource tags
+ * @return the next update stage
+ */
+ Update withTags(Map tags);
+ }
+
+ /**
+ * The stage of the linkedservice update allowing to specify WriteAccessResourceId.
+ */
+ interface WithWriteAccessResourceId {
+ /**
+ * Specifies writeAccessResourceId.
+ * @param writeAccessResourceId The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require write access
+ * @return the next update stage
+ */
+ Update withWriteAccessResourceId(String writeAccessResourceId);
+ }
+
+ }
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/LinkedServiceEntityStatus.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/LinkedServiceEntityStatus.java
new file mode 100644
index 0000000000000..9c675b63369bd
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/LinkedServiceEntityStatus.java
@@ -0,0 +1,47 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import java.util.Collection;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.microsoft.rest.ExpandableStringEnum;
+
+/**
+ * Defines values for LinkedServiceEntityStatus.
+ */
+public final class LinkedServiceEntityStatus extends ExpandableStringEnum {
+ /** Static value Succeeded for LinkedServiceEntityStatus. */
+ public static final LinkedServiceEntityStatus SUCCEEDED = fromString("Succeeded");
+
+ /** Static value Deleting for LinkedServiceEntityStatus. */
+ public static final LinkedServiceEntityStatus DELETING = fromString("Deleting");
+
+ /** Static value ProvisioningAccount for LinkedServiceEntityStatus. */
+ public static final LinkedServiceEntityStatus PROVISIONING_ACCOUNT = fromString("ProvisioningAccount");
+
+ /** Static value Updating for LinkedServiceEntityStatus. */
+ public static final LinkedServiceEntityStatus UPDATING = fromString("Updating");
+
+ /**
+ * Creates or finds a LinkedServiceEntityStatus from its string representation.
+ * @param name a name to look for
+ * @return the corresponding LinkedServiceEntityStatus
+ */
+ @JsonCreator
+ public static LinkedServiceEntityStatus fromString(String name) {
+ return fromString(name, LinkedServiceEntityStatus.class);
+ }
+
+ /**
+ * @return known LinkedServiceEntityStatus values
+ */
+ public static Collection values() {
+ return values(LinkedServiceEntityStatus.class);
+ }
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/LinkedServices.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/LinkedServices.java
new file mode 100644
index 0000000000000..3966708a02630
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/LinkedServices.java
@@ -0,0 +1,53 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.microsoft.azure.arm.collection.SupportsCreating;
+import rx.Completable;
+import rx.Observable;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.LinkedServicesInner;
+import com.microsoft.azure.arm.model.HasInner;
+
+/**
+ * Type representing LinkedServices.
+ */
+public interface LinkedServices extends SupportsCreating, HasInner {
+ /**
+ * Gets a linked service instance.
+ *
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
+ * @param workspaceName The name of the workspace.
+ * @param linkedServiceName Name of the linked service.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Observable getAsync(String resourceGroupName, String workspaceName, String linkedServiceName);
+
+ /**
+ * Gets the linked services instances in a workspace.
+ *
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
+ * @param workspaceName The name of the workspace.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Observable listByWorkspaceAsync(String resourceGroupName, String workspaceName);
+
+ /**
+ * Deletes a linked service instance.
+ *
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
+ * @param workspaceName The name of the workspace.
+ * @param linkedServiceName Name of the linked service.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Completable deleteAsync(String resourceGroupName, String workspaceName, String linkedServiceName);
+
+}
diff --git a/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/LinkedStorageAccounts.java b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/LinkedStorageAccounts.java
new file mode 100644
index 0000000000000..6bcc67436946f
--- /dev/null
+++ b/sdk/loganalytics/mgmt-v2020_08_01/src/main/java/com/microsoft/azure/management/loganalytics/v2020_08_01/LinkedStorageAccounts.java
@@ -0,0 +1,53 @@
+/**
+ * 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.loganalytics.v2020_08_01;
+
+import com.microsoft.azure.arm.collection.SupportsCreating;
+import rx.Completable;
+import rx.Observable;
+import com.microsoft.azure.management.loganalytics.v2020_08_01.implementation.LinkedStorageAccountsInner;
+import com.microsoft.azure.arm.model.HasInner;
+
+/**
+ * Type representing LinkedStorageAccounts.
+ */
+public interface LinkedStorageAccounts extends SupportsCreating, HasInner {
+ /**
+ * Gets all linked storage account of a specific data source type associated with the specified workspace.
+ *
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
+ * @param workspaceName The name of the workspace.
+ * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson', 'Query', 'Alerts'
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Observable getAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType);
+
+ /**
+ * Gets all linked storage accounts associated with the specified workspace, storage accounts will be sorted by their data source type.
+ *
+ * @param resourceGroupName The name of the resource group. The name is case insensitive.
+ * @param workspaceName The name of the workspace.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Observable