File tree Expand file tree Collapse file tree 4 files changed +87
-0
lines changed
formrecognizer/azure-ai-formrecognizer/src/main/java/com/azure/ai/formrecognizer
textanalytics/azure-ai-textanalytics/src/main/java/com/azure/ai/textanalytics Expand file tree Collapse file tree 4 files changed +87
-0
lines changed Original file line number Diff line number Diff line change 33
44package com .azure .ai .formrecognizer ;
55
6+ import com .azure .ai .formrecognizer .implementation .Constants ;
67import com .azure .ai .formrecognizer .implementation .FormRecognizerClientImpl ;
78import com .azure .ai .formrecognizer .implementation .FormRecognizerClientImplBuilder ;
89import com .azure .core .annotation .ServiceClientBuilder ;
@@ -205,6 +206,15 @@ public FormRecognizerClientBuilder httpLogOptions(HttpLogOptions logOptions) {
205206 return this ;
206207 }
207208
209+ /**
210+ * Gets the default Azure Form Recognizer headers and query parameters allow list.
211+ *
212+ * @return The default {@link HttpLogOptions} allow list.
213+ */
214+ public static HttpLogOptions getDefaultLogOptions () {
215+ return Constants .DEFAULT_LOG_OPTIONS_SUPPLIER .get ();
216+ }
217+
208218 /**
209219 * Sets the client options such as application ID and custom headers to set on a request.
210220 *
Original file line number Diff line number Diff line change 1+ // Copyright (c) Microsoft Corporation. All rights reserved.
2+ // Licensed under the MIT License.
3+
4+ package com .azure .ai .formrecognizer .implementation ;
5+
6+ import com .azure .core .http .policy .HttpLogOptions ;
7+
8+ import java .util .function .Supplier ;
9+
10+ public class Constants {
11+
12+ public static final Supplier <HttpLogOptions > DEFAULT_LOG_OPTIONS_SUPPLIER = () -> {
13+ HttpLogOptions logOptions = new HttpLogOptions ();
14+
15+ logOptions .addAllowedHeaderName ("Operation-Location" );
16+ logOptions .addAllowedHeaderName ("Location" );
17+ logOptions .addAllowedHeaderName ("x-envoy-upstream-service-time" );
18+ logOptions .addAllowedHeaderName ("apim-request-id" );
19+ logOptions .addAllowedHeaderName ("Strict-Transport-Security" );
20+ logOptions .addAllowedHeaderName ("x-content-type-options" );
21+ logOptions .addAllowedHeaderName ("ms-azure-ai-errorcode" );
22+ logOptions .addAllowedHeaderName ("x-ms-cs-error-code" );
23+
24+ logOptions .addAllowedQueryParamName ("includeTextDetails" );
25+ logOptions .addAllowedQueryParamName ("locale" );
26+ logOptions .addAllowedQueryParamName ("language" );
27+ logOptions .addAllowedQueryParamName ("includeKeys" );
28+ logOptions .addAllowedQueryParamName ("op" );
29+ logOptions .addAllowedQueryParamName ("pages" );
30+ logOptions .addAllowedQueryParamName ("readingOrder" );
31+
32+ return logOptions ;
33+ };
34+ }
Original file line number Diff line number Diff line change 33
44package com .azure .ai .textanalytics ;
55
6+ import com .azure .ai .textanalytics .implementation .Constants ;
67import com .azure .ai .textanalytics .implementation .TextAnalyticsClientImpl ;
78import com .azure .ai .textanalytics .implementation .TextAnalyticsClientImplBuilder ;
89import com .azure .core .annotation .ServiceClientBuilder ;
@@ -301,6 +302,15 @@ public TextAnalyticsClientBuilder httpLogOptions(HttpLogOptions logOptions) {
301302 return this ;
302303 }
303304
305+ /**
306+ * Gets the default Azure Text Analytics headers and query parameters allow list.
307+ *
308+ * @return The default {@link HttpLogOptions} allow list.
309+ */
310+ public static HttpLogOptions getDefaultLogOptions () {
311+ return Constants .DEFAULT_LOG_OPTIONS_SUPPLIER .get ();
312+ }
313+
304314 /**
305315 * Sets the client options such as application ID and custom headers to set on a request.
306316 *
Original file line number Diff line number Diff line change 1+ // Copyright (c) Microsoft Corporation. All rights reserved.
2+ // Licensed under the MIT License.
3+
4+ package com .azure .ai .textanalytics .implementation ;
5+
6+ import com .azure .core .http .policy .HttpLogOptions ;
7+
8+ import java .util .function .Supplier ;
9+
10+ public class Constants {
11+
12+ public static final Supplier <HttpLogOptions > DEFAULT_LOG_OPTIONS_SUPPLIER = () -> {
13+ HttpLogOptions logOptions = new HttpLogOptions ();
14+
15+ logOptions .addAllowedHeaderName ("Operation-Location" );
16+ logOptions .addAllowedHeaderName ("x-envoy-upstream-service-time" );
17+ logOptions .addAllowedHeaderName ("apim-request-id" );
18+ logOptions .addAllowedHeaderName ("Strict-Transport-Security" );
19+ logOptions .addAllowedHeaderName ("x-content-type-options" );
20+
21+ logOptions .addAllowedQueryParamName ("jobId" );
22+ logOptions .addAllowedQueryParamName ("$top" );
23+ logOptions .addAllowedQueryParamName ("$skip" );
24+ logOptions .addAllowedQueryParamName ("showStats" );
25+ logOptions .addAllowedQueryParamName ("model-version" );
26+ logOptions .addAllowedQueryParamName ("domain" );
27+ logOptions .addAllowedQueryParamName ("stringIndexType" );
28+ logOptions .addAllowedQueryParamName ("piiCategories" );
29+ logOptions .addAllowedQueryParamName ("opinionMining" );
30+
31+ return logOptions ;
32+ };
33+ }
You can’t perform that action at this time.
0 commit comments