Class DefaultHttpDestination.Builder

java.lang.Object
com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpDestination.Builder
Enclosing class:
DefaultHttpDestination

public static class DefaultHttpDestination.Builder extends Object
Builder class to allow for easy creation of an immutable DefaultHttpDestination instance.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • property

      @Nonnull public DefaultHttpDestination.Builder property(@Nonnull String key, @Nonnull Object value)
      Adds the given key-value pair to the destination to be created. This will overwrite any property already assigned to the key.
      Parameters:
      key - The key to assign a property for.
      value - The property value to be assigned.
      Returns:
      This builder.
      Since:
      5.0.0
    • property

      @Nonnull public <ValueT> DefaultHttpDestination.Builder property(@Nonnull DestinationPropertyKey<ValueT> key, @Nonnull ValueT value)
      Adds the given key-value pair to the destination to be created. This will overwrite any property already assigned to the key.
      Type Parameters:
      ValueT - The type of the property value.
      Parameters:
      key - The DestinationPropertyKey to assign a property for.
      value - The property value to be assigned.
      Returns:
      This builder.
      Since:
      5.0.0
    • name

      @Nonnull public DefaultHttpDestination.Builder name(@Nonnull String name)
      Sets the name of the DefaultHttpDestination.
      Parameters:
      name - The destination name
      Returns:
      This builder.
    • uri

      @Nonnull public DefaultHttpDestination.Builder uri(@Nonnull URI uri)
      Sets the URI of the to-be-built DefaultHttpDestination.
      Parameters:
      uri - The URI to set.
      Returns:
      This builder.
      Since:
      5.0.0
    • uri

      @Nonnull public DefaultHttpDestination.Builder uri(@Nonnull String uri)
      Sets the URI of the to-be-built DefaultHttpDestination.
      Parameters:
      uri - The URI to set.
      Returns:
      This builder.
      Since:
      5.0.0
    • tlsVersion

      @Nonnull public DefaultHttpDestination.Builder tlsVersion(@Nonnull String value)
      Sets the TLS version used by the DefaultHttpDestination to the given value.
      Parameters:
      value - The TLS version that should be used.
      Returns:
      This builder.
    • keyStorePassword

      @Nonnull public DefaultHttpDestination.Builder keyStorePassword(@Nonnull String value)
      Sets the key store password for the corresponding KeyStore used by the DefaultHttpDestination to access the key store.
      Parameters:
      value - The keyStore password that should be used.
      Returns:
      This builder.
    • keyStore

      @Nonnull public DefaultHttpDestination.Builder keyStore(@Nonnull KeyStore keyStore)
      Sets the KeyStore to be used when communicating over HTTP.
      Parameters:
      keyStore - The keyStore that should be used for HTTP communication
      Returns:
      This builder.
    • trustStore

      @Nonnull public DefaultHttpDestination.Builder trustStore(@Nonnull KeyStore trustStore)
      Sets the Trust Store to be used when communicating over HTTP.
      Parameters:
      trustStore - The Trust Store that should be used. for HTTP communication
      Returns:
      This builder.
    • trustAllCertificates

      @Nonnull public DefaultHttpDestination.Builder trustAllCertificates()
      Lets the DefaultHttpDestination trust all server certificates.
      Returns:
      This builder.
    • trustStorePassword

      @Nonnull public DefaultHttpDestination.Builder trustStorePassword(@Nonnull String value)
      Sets the password of the trust store.
      Parameters:
      value - The trust store password that should be used.
      Returns:
      This builder.
    • cloudConnectorLocationId

      @Nonnull public DefaultHttpDestination.Builder cloudConnectorLocationId(@Nonnull String locationId)
      Sets the connectivity location id of the destination.
      Parameters:
      locationId - The location identifier for connecting to SAP Cloud Connector.
      Returns:
      This builder.
    • proxyConfiguration

      @Nonnull public DefaultHttpDestination.Builder proxyConfiguration(@Nonnull ProxyConfiguration value)
      Sets the proxy used by the destination to the given value.
      Parameters:
      value - The proxy that should be used.
      Returns:
      This builder.
    • headers

      @Nonnull public DefaultHttpDestination.Builder headers(@Nonnull Collection<Header> headers)
      Adds the given headers to the list of headers added to every outgoing request for this destination.
      Parameters:
      headers - Headers to add to outgoing requests.
      Returns:
      This builder.
    • proxy

      @Nonnull public DefaultHttpDestination.Builder proxy(@Nonnull URI proxyUri)
      Sets the proxy URI of the DefaultHttpDestination.
      Parameters:
      proxyUri - The URI of the proxy
      Returns:
      This builder.
    • proxyAuthorization

      @Nonnull public DefaultHttpDestination.Builder proxyAuthorization(@Nonnull String proxyAuthorization)
      Sets the proxy authorization header of the DefaultHttpDestination.
      Parameters:
      proxyAuthorization - The authorization header value
      Returns:
      This builder.
    • proxyType

      @Nonnull public DefaultHttpDestination.Builder proxyType(@Nonnull ProxyType proxyType)
      Sets the proxy type (Internet or On-Premise).
      Parameters:
      proxyType - Type of proxy this destination is configured for.
      Returns:
      This builder.
    • proxy

      @Nonnull public DefaultHttpDestination.Builder proxy(@Nonnull String proxyHost, int proxyPort)
      Sets the proxy host and proxy port of the DefaultHttpDestination.
      Parameters:
      proxyHost - The host of the proxy
      proxyPort - The port of the proxy
      Returns:
      This builder.
    • basicCredentials

      @Nonnull public DefaultHttpDestination.Builder basicCredentials(@Nonnull BasicCredentials basicCredentials)
      Sets the credentials for accessing the destination when basic authentication is used.
      Parameters:
      basicCredentials - Username and password represented as a BasicCredentials object.
      Returns:
      This builder.
    • basicCredentials

      @Nonnull public DefaultHttpDestination.Builder basicCredentials(@Nonnull String user, @Nonnull String password)
      Sets the credentials for accessing the destination using AuthenticationType.BASIC_AUTHENTICATION.
      Parameters:
      user - The user.
      password - The password.
      Returns:
      This builder.
    • authenticationType

      @Nonnull public DefaultHttpDestination.Builder authenticationType(@Nonnull AuthenticationType authenticationType)
      Sets the expected authentication type of the DefaultHttpDestination.
      Parameters:
      authenticationType - The type of authentication for the destination
      Returns:
      This builder.
    • header

      @Nonnull public DefaultHttpDestination.Builder header(@Nonnull Header header)
      Adds the given header to the list of headers added to every outgoing request for this destination.
      Parameters:
      header - A header to add to outgoing requests.
      Returns:
      This builder.
    • header

      @Nonnull public DefaultHttpDestination.Builder header(@Nonnull String headerName, @Nonnull String headerValue)
      Adds a header given by the headerName and headerValue to the list of headers added to every outgoing request for this destination.
      Parameters:
      headerName - The name of the header to add.
      headerValue - The value of the header to add.
      Returns:
      This builder.
    • securityConfiguration

      @Nonnull public DefaultHttpDestination.Builder securityConfiguration(@Nonnull SecurityConfigurationStrategy securityConfigurationStrategy)
      Sets the SecurityConfigurationStrategy for outbound calls via this Destination to decide if the SSLContext should be derived from the Destination Configuration or from the cloud platform (i.e. the environment).
      Parameters:
      securityConfigurationStrategy - The strategy to use
      Returns:
      This builder
    • headerProviders

      @Nonnull public DefaultHttpDestination.Builder headerProviders(@Nonnull DestinationHeaderProvider... headerProviders)
      Registers the provided DestinationHeaderProvider instances on this Destination.

      For all outgoing requests, the registered header providers are invoked and the returned headers are added to the request.

      Parameters:
      headerProviders - The header provider instances
      Returns:
      This builder
    • build

      @Nonnull public DefaultHttpDestination build()
      Finally creates the DefaultHttpDestination with the properties retrieved via the property(String, Object) method.
      Returns:
      A fully instantiated DefaultHttpDestination.