public final class FormTrainingClientBuilder extends Object
FormTrainingClient
and FormTrainingAsyncClient
, call FormTrainingClientBuilder.buildClient()
buildClient} and
buildAsyncClient
respectively to construct an instance of the desired client.
The client needs the service endpoint of the Azure Form Recognizer to access the resource service.
FormTrainingClientBuilder.credential(AzureKeyCredential)
or credential(TokenCredential)
gives
the builder access credential.
Instantiating an asynchronous Form Training Client
Snippet 'com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.initialization' not found.
Instantiating a synchronous Form Training Client
Snippet 'com.azure.ai.formrecognizer.training.FormTrainingClient.initialization' not found.
Another way to construct the client is using a HttpPipeline
. The pipeline gives the client an
authenticated way to communicate with the service. Set the pipeline with this
and
set the service endpoint with this
. Using a
pipeline requires additional setup but allows for finer control on how the FormTrainingClient
and
FormTrainingAsyncClient
is built.
Snippet 'com.azure.ai.formrecognizer.training.FormTrainingAsyncClient.pipeline.instantiation' not found.
FormTrainingAsyncClient
,
FormTrainingClient
Constructor and Description |
---|
FormTrainingClientBuilder() |
Modifier and Type | Method and Description |
---|---|
FormTrainingClientBuilder |
addPolicy(HttpPipelinePolicy policy)
Adds a policy to the set of existing policies that are executed after required policies.
|
FormTrainingAsyncClient |
buildAsyncClient()
Creates a
FormTrainingAsyncClient based on options set in the builder. |
FormTrainingClient |
buildClient()
Creates a
FormTrainingClient based on options set in the builder. |
FormTrainingClientBuilder |
clientOptions(ClientOptions clientOptions)
Sets the client options such as application ID and custom headers to set on a request.
|
FormTrainingClientBuilder |
configuration(Configuration configuration)
Sets the configuration store that is used during construction of the service client.
|
FormTrainingClientBuilder |
credential(AzureKeyCredential apiKeyCredential)
Sets the
AzureKeyCredential to use when authenticating HTTP requests for this
FormTrainingClientBuilder. |
FormTrainingClientBuilder |
credential(TokenCredential tokenCredential)
Sets the
TokenCredential used to authenticate HTTP requests. |
FormTrainingClientBuilder |
endpoint(String endpoint)
Sets the service endpoint for the Azure Form Recognizer instance.
|
static HttpLogOptions |
getDefaultLogOptions()
Gets the default Azure Form Training client headers and query parameters that are logged by default if
HTTP logging is enabled.
|
FormTrainingClientBuilder |
httpClient(HttpClient client)
Sets the HTTP client to use for sending and receiving requests to and from the service.
|
FormTrainingClientBuilder |
httpLogOptions(HttpLogOptions logOptions)
Sets the logging configuration for HTTP requests and responses.
|
FormTrainingClientBuilder |
pipeline(HttpPipeline httpPipeline)
Sets the HTTP pipeline to use for the service client.
|
FormTrainingClientBuilder |
retryPolicy(RetryPolicy retryPolicy)
Sets the
RetryPolicy.RetryPolicy() that is used when each request is sent. |
FormTrainingClientBuilder |
serviceVersion(FormRecognizerServiceVersion version)
Sets the
FormRecognizerServiceVersion that is used when making API requests. |
public FormTrainingClient buildClient()
FormTrainingClient
based on options set in the builder. Every time
buildClient()
is called a new instance of FormTrainingClient
is created.
If pipeline
is set, then the pipeline
and
endpoint
are used to create the client
. All other builder
settings are ignored.
NullPointerException
- if endpoint
or
FormTrainingClientBuilder.credential(AzureKeyCredential)
has not been set.IllegalArgumentException
- if endpoint
cannot be parsed into a valid URL.public FormTrainingAsyncClient buildAsyncClient()
FormTrainingAsyncClient
based on options set in the builder. Every time
buildAsyncClient()
is called a new instance of FormTrainingAsyncClient
is created.
If pipeline
is set, then the pipeline
and
endpoint
are used to create the client
. All other builder
settings are ignored.
NullPointerException
- if endpoint
or FormTrainingClientBuilder.credential(AzureKeyCredential)
has not been set.IllegalArgumentException
- if endpoint
cannot be parsed into a valid URL.public FormTrainingClientBuilder endpoint(String endpoint)
endpoint
- The URL of the Azure Form Recognizer instance service requests to and receive responses from.NullPointerException
- if endpoint
is null.IllegalArgumentException
- if endpoint
cannot be parsed into a valid URL.public FormTrainingClientBuilder credential(AzureKeyCredential apiKeyCredential)
AzureKeyCredential
to use when authenticating HTTP requests for this
FormTrainingClientBuilder.apiKeyCredential
- AzureKeyCredential
API key credential.NullPointerException
- If apiKeyCredential
is null.public FormTrainingClientBuilder credential(TokenCredential tokenCredential)
TokenCredential
used to authenticate HTTP requests.tokenCredential
- TokenCredential
used to authenticate HTTP requests.FormTrainingClientBuilder
object.NullPointerException
- If tokenCredential
is null.public FormTrainingClientBuilder httpLogOptions(HttpLogOptions logOptions)
If logOptions
isn't provided, the default options will use HttpLogDetailLevel.NONE
which will prevent logging.
logOptions
- The logging configuration to use when sending and receiving HTTP requests/responses.public static HttpLogOptions getDefaultLogOptions()
HttpLogOptions
allow list.public FormTrainingClientBuilder clientOptions(ClientOptions clientOptions)
clientOptions
- The client options.public FormTrainingClientBuilder addPolicy(HttpPipelinePolicy policy)
policy
- The retry policy for service requests.NullPointerException
- If policy
is null.public FormTrainingClientBuilder httpClient(HttpClient client)
client
- The HTTP client to use for requests.public FormTrainingClientBuilder pipeline(HttpPipeline httpPipeline)
If pipeline
is set, all other settings are ignored, aside from
endpoint
to build FormTrainingAsyncClient
or
FormTrainingClient
.
httpPipeline
- The HTTP pipeline to use for sending service requests and receiving responses.public FormTrainingClientBuilder configuration(Configuration configuration)
The default configuration store is a clone of the global
configuration store
, use Configuration.NONE
to bypass using configuration settings during construction.
configuration
- The configuration store used to.public FormTrainingClientBuilder retryPolicy(RetryPolicy retryPolicy)
RetryPolicy.RetryPolicy()
that is used when each request is sent.
The default retry policy will be used if not provided FormTrainingClientBuilder.buildAsyncClient()
to build FormTrainingAsyncClient
or FormTrainingClient
.
retryPolicy
- user's retry policy applied to each request.public FormTrainingClientBuilder serviceVersion(FormRecognizerServiceVersion version)
FormRecognizerServiceVersion
that is used when making API requests.
If a service version is not provided, the service version that will be used will be the latest known service version based on the version of the client library being used. If no service version is specified, updating to a newer version the client library will have the result of potentially moving to a newer service version.
version
- FormRecognizerServiceVersion
of the service to be used when making requests.Copyright © 2021. All rights reserved.