Class MapsRouteClientBuilder

java.lang.Object
com.azure.maps.route.MapsRouteClientBuilder
All Implemented Interfaces:
com.azure.core.client.traits.AzureKeyCredentialTrait<MapsRouteClientBuilder>, com.azure.core.client.traits.ConfigurationTrait<MapsRouteClientBuilder>, com.azure.core.client.traits.EndpointTrait<MapsRouteClientBuilder>, com.azure.core.client.traits.HttpTrait<MapsRouteClientBuilder>, com.azure.core.client.traits.TokenCredentialTrait<MapsRouteClientBuilder>

public final class MapsRouteClientBuilder extends Object implements com.azure.core.client.traits.AzureKeyCredentialTrait<MapsRouteClientBuilder>, com.azure.core.client.traits.TokenCredentialTrait<MapsRouteClientBuilder>, com.azure.core.client.traits.HttpTrait<MapsRouteClientBuilder>, com.azure.core.client.traits.ConfigurationTrait<MapsRouteClientBuilder>, com.azure.core.client.traits.EndpointTrait<MapsRouteClientBuilder>
Builder class used to instantiate both synchronous and asynchronous MapsRouteClient clients. Creating a sync client using a AzureKeyCredential:
 // Authenticates using subscription key
 AzureKeyCredential keyCredential = new AzureKeyCredential(System.getenv("SUBSCRIPTION_KEY"));

 // Creates a builder
 MapsRouteClientBuilder builder = new MapsRouteClientBuilder();
 builder.credential(keyCredential);
 builder.httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS));

 // Builds the client
 MapsRouteClient client = builder.buildClient();
 
Creating a sync client using a TokenCredential:
 // Authenticates using Azure AD building a default credential
 // This will look for AZURE_CLIENT_ID, AZURE_TENANT_ID, and AZURE_CLIENT_SECRET env variables
 DefaultAzureCredential tokenCredential = new DefaultAzureCredentialBuilder().build();

 // Creates a builder
 MapsRouteClientBuilder builder = new MapsRouteClientBuilder();
 builder.credential(tokenCredential);
 builder.mapsClientId(System.getenv("MAPS_CLIENT_ID"));
 builder.httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS));

 // Builds a client
 MapsRouteClient client = builder.buildClient();
 
  • Constructor Details

    • MapsRouteClientBuilder

      public MapsRouteClientBuilder()
      Default constructor for the builder class.
  • Method Details

    • mapsClientId

      public MapsRouteClientBuilder mapsClientId(String mapsClientId)
      Sets the Azure Maps client id for use with Azure AD Authentication. This client id is the account-based GUID that appears on the Azure Maps Authentication page. More details: Azure Maps AD Authentication
      Parameters:
      mapsClientId - the clientId value.
      Returns:
      the SearchClientBuilder.
    • endpoint

      public MapsRouteClientBuilder endpoint(String endpoint)
      Set endpoint of the service.
      Specified by:
      endpoint in interface com.azure.core.client.traits.EndpointTrait<MapsRouteClientBuilder>
      Parameters:
      endpoint - url of the service
      Returns:
      SearchClientBuilder
    • serviceVersion

      public MapsRouteClientBuilder serviceVersion(MapsRouteServiceVersion version)
      Sets the MapsRouteServiceVersion 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 of the client library will have the result of potentially moving to a newer service version.

      Targeting a specific service version may also mean that the service will return an error for newer APIs.

      Parameters:
      version - MapsRouteServiceVersion of the service to be used when making requests.
      Returns:
      the updated RouteClientBuilder object
    • pipeline

      public MapsRouteClientBuilder pipeline(com.azure.core.http.HttpPipeline pipeline)
      Sets The HTTP pipeline to send requests through.
      Specified by:
      pipeline in interface com.azure.core.client.traits.HttpTrait<MapsRouteClientBuilder>
      Parameters:
      pipeline - the pipeline value.
      Returns:
      the SearchClientBuilder.
    • httpClient

      public MapsRouteClientBuilder httpClient(com.azure.core.http.HttpClient httpClient)
      Sets The HTTP client used to send the request.
      Specified by:
      httpClient in interface com.azure.core.client.traits.HttpTrait<MapsRouteClientBuilder>
      Parameters:
      httpClient - the httpClient value.
      Returns:
      the SearchClientBuilder.
    • configuration

      public MapsRouteClientBuilder configuration(com.azure.core.util.Configuration configuration)
      Sets The configuration store that is used during construction of the service client.
      Specified by:
      configuration in interface com.azure.core.client.traits.ConfigurationTrait<MapsRouteClientBuilder>
      Parameters:
      configuration - the configuration value.
      Returns:
      the SearchClientBuilder.
    • httpLogOptions

      public MapsRouteClientBuilder httpLogOptions(com.azure.core.http.policy.HttpLogOptions httpLogOptions)
      Sets The logging configuration for HTTP requests and responses.
      Specified by:
      httpLogOptions in interface com.azure.core.client.traits.HttpTrait<MapsRouteClientBuilder>
      Parameters:
      httpLogOptions - the httpLogOptions value.
      Returns:
      the SearchClientBuilder.
    • retryPolicy

      public MapsRouteClientBuilder retryPolicy(com.azure.core.http.policy.RetryPolicy retryPolicy)
      Sets The retry policy that will attempt to retry failed requests, if applicable.
      Parameters:
      retryPolicy - the retryPolicy value.
      Returns:
      the SearchClientBuilder.
    • clientOptions

      public MapsRouteClientBuilder clientOptions(com.azure.core.util.ClientOptions clientOptions)
      Sets The client options such as application ID and custom headers to set on a request.
      Specified by:
      clientOptions in interface com.azure.core.client.traits.HttpTrait<MapsRouteClientBuilder>
      Parameters:
      clientOptions - the clientOptions value.
      Returns:
      the SearchClientBuilder.
    • addPolicy

      public MapsRouteClientBuilder addPolicy(com.azure.core.http.policy.HttpPipelinePolicy customPolicy)
      Adds a custom Http pipeline policy.
      Specified by:
      addPolicy in interface com.azure.core.client.traits.HttpTrait<MapsRouteClientBuilder>
      Parameters:
      customPolicy - The custom Http pipeline policy to add.
      Returns:
      the SearchClientBuilder.
    • credential

      public MapsRouteClientBuilder credential(com.azure.core.credential.TokenCredential tokenCredential)
      Sets the TokenCredential used to authenticate HTTP requests.
      Specified by:
      credential in interface com.azure.core.client.traits.TokenCredentialTrait<MapsRouteClientBuilder>
      Parameters:
      tokenCredential - TokenCredential used to authenticate HTTP requests.
      Returns:
      The updated MapsRouteClientBuilder object.
      Throws:
      NullPointerException - If tokenCredential is null.
    • credential

      public MapsRouteClientBuilder credential(com.azure.core.credential.AzureKeyCredential keyCredential)
      Sets the AzureKeyCredential used to authenticate HTTP requests.
      Specified by:
      credential in interface com.azure.core.client.traits.AzureKeyCredentialTrait<MapsRouteClientBuilder>
      Parameters:
      keyCredential - The AzureKeyCredential used to authenticate HTTP requests.
      Returns:
      The updated MapsRouteClientBuilder object.
      Throws:
      NullPointerException - If keyCredential is null.
    • retryOptions

      public MapsRouteClientBuilder retryOptions(com.azure.core.http.policy.RetryOptions retryOptions)
      Sets retry options
      Specified by:
      retryOptions in interface com.azure.core.client.traits.HttpTrait<MapsRouteClientBuilder>
      Parameters:
      retryOptions - the retry options for the client
      Returns:
      a reference to this RouteClientBuilder
    • buildAsyncClient

      public MapsRouteAsyncClient buildAsyncClient()
      Builds an instance of SearchAsyncClient async client.
      Returns:
      an instance of SearchAsyncClient.
    • buildClient

      public MapsRouteClient buildClient()
      Builds an instance of SearchClient sync client.
      Returns:
      an instance of SearchClient.