@Beta public final class ScpCfServiceDestinationLoader extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ScpCfServiceDestinationLoader.CfServices
The services currently supported by the convenience API
getDestinationForService(CfServices, String) and
getDestinationForService(CfServices) are listed in this enum. |
Constructor and Description |
---|
ScpCfServiceDestinationLoader() |
Modifier and Type | Method and Description |
---|---|
static Map<String,String> |
buildClientCredentialsMapping(String urlPath,
String clientIdPath,
String clientSecretPath,
String tokenUrlPath)
Helper method to create a mapping for loading a destination with authentication type
client credentials via getDestinationForService(java.lang.String, com.sap.cloud.sdk.cloudplatform.connectivity.AuthenticationType, java.util.Map<java.lang.String, java.lang.String>) . |
static HttpDestination |
getDestinationForService(ScpCfServiceDestinationLoader.CfServices service)
Build a destination to reach an SCP Cloud Foundry service based on the service
ScpCfServiceDestinationLoader.CfServices value provided. |
static HttpDestination |
getDestinationForService(ScpCfServiceDestinationLoader.CfServices service,
String serviceBindingName)
Build a destination to reach an SCP Cloud Foundry service based on the service
ScpCfServiceDestinationLoader.CfServices value provided. |
static HttpDestination |
getDestinationForService(String label,
AuthenticationType authenticationType,
Map<String,String> propertyMapping)
Build a destination to reach an SCP Cloud Foundry service.
|
static HttpDestination |
getDestinationForService(String label,
String serviceBindingName,
AuthenticationType authenticationType,
Map<String,String> propertyMapping)
Build a destination to reach an SCP Cloud Foundry service.
|
@Nonnull @Beta public static HttpDestination getDestinationForService(@Nonnull String label, @Nonnull AuthenticationType authenticationType, @Nonnull Map<String,String> propertyMapping)
label
- The service type to look for, e.g. destination or workflowauthenticationType
- The authentication type
that is used to access the service. Currently only
no authentication
and
client credentials
are supported.propertyMapping
- A map describing where necessary destination information will be found in the service binding JSON. A
value is a JSON path of the service definition while a key is it's property in the destination. All
authentication types require the URL
property to be defined. Which other information is
necessary depends on the authentication type.NoServiceBindingException
- if the specified service was not found amongst the service bindings.DestinationAccessException
- if creating the destination failed.@Nonnull @Beta public static HttpDestination getDestinationForService(@Nonnull String label, @Nullable String serviceBindingName, @Nonnull AuthenticationType authenticationType, @Nonnull Map<String,String> propertyMapping)
label
- The service type to look for, e.g. destination or workflowserviceBindingName
- Optional: The name of the service binding. If none is provided simply the first service binding for
the service type will be taken.authenticationType
- The authentication type
that is used to access the service. Currently only
no authentication
and
client credentials
are supported.propertyMapping
- A map describing where necessary destination information will be found in the service binding JSON. A
value is a JSON path of the service definition while a key is it's property in the destination. All
authentication types require the URL
property to be defined. Which other information is
necessary depends on the authentication type.
For authenticating with AuthenticationType.OAUTH2_CLIENT_CREDENTIALS
the following fields are
needed: uri
, clientId
, clientSecret
and tokenEndpointUri
. For example
a mapping could look like this:
uri | serviceUri |
clientId | credentials.clientId |
clientSecret | credentials.clientSecret |
tokenEndpointUri | credentials.uaa.url |
NoServiceBindingException
- if the specified service was not found amongst the service bindings.DestinationAccessException
- if creating the destination failed.@Nonnull @Beta public static HttpDestination getDestinationForService(@Nonnull ScpCfServiceDestinationLoader.CfServices service, @Nullable String serviceBindingName)
ScpCfServiceDestinationLoader.CfServices
value provided.
Currently, this is only supported for the workflow service. This service info will be retrieved from the Cloud
Platform environment variables. In the standard use case these will be the VCAP_SERVICES. This is a convenient
method to retrieve a destination by just providing the service ScpCfServiceDestinationLoader.CfServices
. For other services, please use
getDestinationForService(String, String, AuthenticationType, Map)
or
getDestinationForService(String, AuthenticationType, Map)
}service
- The service type to look for use ScpCfServiceDestinationLoader.CfServices
to supply a valueserviceBindingName
- Optional: The name of the service binding. If none is provided simply the first service binding for
the service type will be taken.@Nonnull @Beta public static HttpDestination getDestinationForService(@Nonnull ScpCfServiceDestinationLoader.CfServices service)
ScpCfServiceDestinationLoader.CfServices
value provided.
Currently, this is only supported for the workflow service. This service info will be retrieved from the Cloud
Platform environment variables. In the standard use case these will be the VCAP_SERVICES. This is a convenient
method to retrieve a destination by just providing the service ScpCfServiceDestinationLoader.CfServices
. For other services, please use
getDestinationForService(String, String, AuthenticationType, Map)
or
getDestinationForService(String, AuthenticationType, Map)
}service
- The service type to look for use ScpCfServiceDestinationLoader.CfServices
to supply a value@Nonnull public static Map<String,String> buildClientCredentialsMapping(@Nonnull String urlPath, @Nonnull String clientIdPath, @Nonnull String clientSecretPath, @Nonnull String tokenUrlPath)
client credentials
via getDestinationForService(java.lang.String, com.sap.cloud.sdk.cloudplatform.connectivity.AuthenticationType, java.util.Map<java.lang.String, java.lang.String>)
.
This method will fill in the provided JSON paths for all required properties. You may add any additional entries
for custom properties to the returned map.urlPath
- JSON path identifying the URL within the service binding JSON.clientIdPath
- JSON path identifying the client ID within the service binding JSON.clientSecretPath
- JSON path identifying the client secret within the service binding JSON.tokenUrlPath
- JSON path identifying the token endpoint within the service binding JSON.getDestinationForService(java.lang.String, com.sap.cloud.sdk.cloudplatform.connectivity.AuthenticationType, java.util.Map<java.lang.String, java.lang.String>)
.Copyright © 2021 SAP SE. All rights reserved.