Class DocumentModelAdministrationClientBuilder


  • public final class DocumentModelAdministrationClientBuilder
    extends Object
    This class provides a fluent builder API to help instantiation of FormRecognizerAdminClient and DocumentTrainingAsyncClient, call 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. credential(AzureKeyCredential) or credential(TokenCredential) gives the builder access credential.

    Instantiating an asynchronous Document Model Administration Client

     DocumentModelAdministrationAsyncClient documentModelAdministrationAsyncClient =
         new DocumentModelAdministrationClientBuilder().buildAsyncClient();
     

    Instantiating a synchronous Document Model Administration Client

     DocumentModelAdministrationClient documentModelAdministrationClient =
         new DocumentModelAdministrationClientBuilder().buildClient();
     

    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 DocumentModelAdministrationClient and DocumentModelAdministrationAsyncClient is built.

     HttpPipeline pipeline = new HttpPipelineBuilder()
         .policies(/* add policies */)
         .build();
    
     DocumentModelAdministrationAsyncClient documentModelAdministrationAsyncClient =
         new DocumentModelAdministrationClientBuilder()
             .credential(new AzureKeyCredential("{key}"))
             .endpoint("{endpoint}")
             .pipeline(pipeline)
             .buildAsyncClient();
     
    See Also:
    DocumentModelAdministrationAsyncClient, DocumentModelAdministrationClient
    • Constructor Detail

      • DocumentModelAdministrationClientBuilder

        public DocumentModelAdministrationClientBuilder()
    • Method Detail

      • endpoint

        public DocumentModelAdministrationClientBuilder endpoint​(String endpoint)
        Sets the service endpoint for the Azure Form Recognizer instance.
        Parameters:
        endpoint - The URL of the Azure Form Recognizer instance service requests to and receive responses from.
        Returns:
        The updated DocumentModelAdministrationClientBuilder object.
        Throws:
        NullPointerException - if endpoint is null.
        IllegalArgumentException - if endpoint cannot be parsed into a valid URL.
      • credential

        public DocumentModelAdministrationClientBuilder credential​(com.azure.core.credential.AzureKeyCredential azureKeyCredential)
        Sets the AzureKeyCredential to use when authenticating HTTP requests for this DocumentModelAdministrationClientBuilder.
        Parameters:
        azureKeyCredential - AzureKeyCredential API key credential.
        Returns:
        The updated DocumentModelAdministrationClientBuilder object.
        Throws:
        NullPointerException - If azureKeyCredential is null.
      • httpLogOptions

        public DocumentModelAdministrationClientBuilder httpLogOptions​(com.azure.core.http.policy.HttpLogOptions logOptions)
        Sets the logging configuration for HTTP requests and responses.

        If logOptions isn't provided, the default options will use HttpLogDetailLevel.NONE which will prevent logging.

        Parameters:
        logOptions - The logging configuration to use when sending and receiving HTTP requests/responses.
        Returns:
        The updated DocumentModelAdministrationClientBuilder object.
      • getDefaultLogOptions

        public static com.azure.core.http.policy.HttpLogOptions getDefaultLogOptions()
        Gets the default Azure Form Training client headers and query parameters that are logged by default if HTTP logging is enabled.
        Returns:
        The default HttpLogOptions allow list.
      • clientOptions

        public DocumentModelAdministrationClientBuilder clientOptions​(com.azure.core.util.ClientOptions clientOptions)
        Sets the client options such as application ID and custom headers to set on a request.
        Parameters:
        clientOptions - The client options.
        Returns:
        The updated DocumentModelAdministrationClientBuilder object.
      • addPolicy

        public DocumentModelAdministrationClientBuilder addPolicy​(com.azure.core.http.policy.HttpPipelinePolicy policy)
        Adds a policy to the set of existing policies that are executed after required policies.
        Parameters:
        policy - The retry policy for service requests.
        Returns:
        The updated DocumentModelAdministrationClientBuilder object.
        Throws:
        NullPointerException - If policy is null.
      • httpClient

        public DocumentModelAdministrationClientBuilder httpClient​(com.azure.core.http.HttpClient client)
        Sets the HTTP client to use for sending and receiving requests to and from the service.
        Parameters:
        client - The HTTP client to use for requests.
        Returns:
        The updated DocumentModelAdministrationClientBuilder object.
      • configuration

        public DocumentModelAdministrationClientBuilder configuration​(com.azure.core.util.Configuration configuration)
        Sets the configuration store that is used during construction of the service client.

        The default configuration store is a clone of the global configuration store, use Configuration.NONE to bypass using configuration settings during construction.

        Parameters:
        configuration - The configuration store used to.
        Returns:
        The updated DocumentModelAdministrationClientBuilder object.
      • serviceVersion

        public DocumentModelAdministrationClientBuilder serviceVersion​(DocumentAnalysisServiceVersion version)
        Sets the DocumentAnalysisServiceVersion 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.

        Parameters:
        version - DocumentAnalysisServiceVersion of the service to be used when making requests.
        Returns:
        The updated DocumentModelAdministrationClientBuilder object.