Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class TransparentProxyDestination implements HttpDestination
static final String TENANT_SUBDOMAIN_HEADER_KEY = "x-tenant-subdomain";
static final String TENANT_ID_HEADER_KEY = "x-tenant-id";
static final String FRAGMENT_OPTIONAL_HEADER_KEY = "x-fragment-optional";
static final String DESTINATION_LEVEL_HEADER_KEY = "x-destination-level";
static final String FRAGMENT_LEVEL_HEADER_KEY = "x-fragment-level";
static final String TOKEN_SERVICE_TENANT_HEADER_KEY = "x-token-service-tenant";
static final String CLIENT_ASSERTION_HEADER_KEY = "x-client-assertion";
static final String CLIENT_ASSERTION_TYPE_HEADER_KEY = "x-client-assertion-type";
Expand Down Expand Up @@ -675,6 +677,36 @@ public GatewayBuilder fragmentName( @Nonnull final String fragmentName )
return header(new Header(FRAGMENT_NAME_HEADER_KEY, fragmentName));
}

/**
* Sets the destination level for the destination-gateway. See <a href=
* "https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/dynamic-lookup-of-destinations">https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/dynamic-lookup-of-destinations</a>
*
* @param destinationLevel
* The level of the destination to use.
* @return This builder instance for method chaining.
*/
@Nonnull
public GatewayBuilder destinationLevel(
@Nonnull final DestinationServiceOptionsAugmenter.CrossLevelScope destinationLevel )
{
return header(new Header(DESTINATION_LEVEL_HEADER_KEY, destinationLevel.toString()));
}

/**
* Sets the fragment level for the destination-gateway. See <a href=
* "https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/dynamic-lookup-of-destinations">https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/dynamic-lookup-of-destinations</a>
*
* @param fragmentLevel
* The level of the fragment to use.
* @return This builder instance for method chaining.
*/
@Nonnull
public GatewayBuilder fragmentLevel(
@Nonnull final DestinationServiceOptionsAugmenter.CrossLevelScope fragmentLevel )
{
return header(new Header(FRAGMENT_LEVEL_HEADER_KEY, fragmentLevel.toString()));
}

/**
* Sets the fragment optional flag for the destination-gateway. See <a href=
* "https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/dynamic-lookup-of-destinations">https://help.sap.com/docs/connectivity/sap-btp-connectivity-cf/dynamic-lookup-of-destinations</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,22 @@ void testGatewayHeaders()
final TransparentProxyDestination destination =
TransparentProxyDestination
.gateway(TEST_DEST_NAME, VALID_URI.toString())
.destinationLevel(DestinationServiceOptionsAugmenter.CrossLevelScope.SUBACCOUNT)
.fragmentName("fragName")
.fragmentLevel(DestinationServiceOptionsAugmenter.CrossLevelScope.PROVIDER_SUBACCOUNT)
.fragmentOptional(true)
.build();

assertThat(destination.getHeaders(VALID_URI))
.contains(
new Header(TransparentProxyDestination.DESTINATION_NAME_HEADER_KEY, TEST_DEST_NAME),
new Header(
TransparentProxyDestination.DESTINATION_LEVEL_HEADER_KEY,
DestinationServiceOptionsAugmenter.CrossLevelScope.SUBACCOUNT.toString()),
new Header(TransparentProxyDestination.FRAGMENT_NAME_HEADER_KEY, "fragName"),
new Header(
TransparentProxyDestination.FRAGMENT_LEVEL_HEADER_KEY,
DestinationServiceOptionsAugmenter.CrossLevelScope.PROVIDER_SUBACCOUNT.toString()),
new Header(TransparentProxyDestination.FRAGMENT_OPTIONAL_HEADER_KEY, "true"));
}

Expand Down