public class ScpCfCloudPlatform extends Object implements CloudPlatform
Constructor and Description |
---|
ScpCfCloudPlatform() |
Modifier and Type | Method and Description |
---|---|
String |
getApplicationName() |
com.google.gson.JsonObject |
getConnectivityServiceCredentials()
Retrieves the connectivity service credentials.
|
List<com.google.gson.JsonObject> |
getConnectivityServiceCredentialsList()
Retrieves the service credentials for all bound connectivity service instances.
|
com.google.gson.JsonObject |
getDestinationServiceCredentials()
Retrieves the destination service credentials.
|
List<com.google.gson.JsonObject> |
getDestinationServiceCredentialsList()
Retrieves the service credentials for all bound destination service instances.
|
Optional<String> |
getEnvironmentVariable(String name) |
static ScpCfCloudPlatform |
getInstanceOrThrow()
Be aware that this method is Beta (as indicated by the annotation) and therefore subject to breaking changes.
|
com.google.gson.JsonObject |
getServiceCredentials(String serviceName)
Retrieves the credentials of a service.
|
com.google.gson.JsonObject |
getServiceCredentials(String serviceName,
String servicePlan)
Retrieves the credentials of a service.
|
Map<String,com.google.gson.JsonElement> |
getVcapApplication()
Provides access to the "VCAP_APPLICATION" environment variable.
|
Map<String,com.google.gson.JsonArray> |
getVcapServices()
Provides access to the "VCAP_SERVICES" environment variable.
|
String |
getXsAppName()
Retrieves the "xsappname" from the XSUAA service instance credentials.
|
com.google.gson.JsonObject |
getXsuaaServiceCredentials()
Retrieves the XSUAA service credentials.
|
com.google.gson.JsonObject |
getXsuaaServiceCredentials(com.auth0.jwt.interfaces.DecodedJWT jwt)
Retrieves the service credentials for all bound XSUAA service instances based on the given JSON Web Token.
|
com.google.gson.JsonObject |
getXsuaaServiceCredentials(String servicePlan)
Retrieves the XSUAA service credentials.
|
List<com.google.gson.JsonObject> |
getXsuaaServiceCredentialsList()
Retrieves the service credentials for all bound XSUAA service instances.
|
@Beta @Nonnull public static ScpCfCloudPlatform getInstanceOrThrow() throws CloudPlatformException
Be aware that this method is Beta (as indicated by the annotation) and therefore subject to breaking changes.
CloudPlatformException
- If not executed on the Cloud Foundry (CF) version of SAP Cloud Platform.@Nonnull public Optional<String> getEnvironmentVariable(@Nonnull String name)
@Nonnull public Map<String,com.google.gson.JsonElement> getVcapApplication() throws CloudPlatformException
JsonElement
entries in "VCAP_APPLICATION" by their names.CloudPlatformException
- If there is an issue accessing the environment variable.@Nonnull public Map<String,com.google.gson.JsonArray> getVcapServices() throws CloudPlatformException
JsonArray
entries in "VCAP_SERVICES" by their names.CloudPlatformException
- If there is an issue accessing the environment variable.@Nonnull public String getApplicationName() throws CloudPlatformException
getApplicationName
in interface CloudPlatform
CloudPlatformException
- If there is an error accessing the application name.@Nonnull public String getXsAppName() throws CloudPlatformException, NoServiceBindingException, MultipleServiceBindingsException
CloudPlatformException
- If there is an issue accessing XS application name.NoServiceBindingException
- If there is no binding to the XSUAA service.MultipleServiceBindingsException
- If there are multiple bindings to the XSUAA service.@Nonnull public com.google.gson.JsonObject getServiceCredentials(@Nonnull String serviceName) throws CloudPlatformException, NoServiceBindingException, MultipleServiceBindingsException
serviceName
- The name of the service.JsonObject
for the service credentials.CloudPlatformException
- If there is an issue accessing the service credentials.NoServiceBindingException
- If there is no binding to the requested service.MultipleServiceBindingsException
- If there are multiple bindings to the requested service.@Nonnull public com.google.gson.JsonObject getServiceCredentials(@Nonnull String serviceName, @Nullable String servicePlan) throws CloudPlatformException, NoServiceBindingException, MultipleServiceBindingsException
serviceName
- The name of the service.servicePlan
- The plan of the service (optional). If null
, the service plan is ignored when retrieving the
service credentials, i.e., only one binding must exist to the service.JsonObject
for the service credentials.CloudPlatformException
- If there is an issue accessing the service credentials.NoServiceBindingException
- If there is no binding to the requested service.MultipleServiceBindingsException
- If there are multiple bindings to the requested service.@Nonnull public com.google.gson.JsonObject getXsuaaServiceCredentials() throws CloudPlatformException, NoServiceBindingException, MultipleServiceBindingsException
JsonObject
for the XSUAA service credentials.CloudPlatformException
- If there is an issue accessing the service credentials.NoServiceBindingException
- If there is no binding to the XSUAA service.MultipleServiceBindingsException
- If there are multiple bindings to the XSUAA service.@Nonnull public com.google.gson.JsonObject getXsuaaServiceCredentials(@Nonnull String servicePlan) throws CloudPlatformException, NoServiceBindingException, MultipleServiceBindingsException
servicePlan
- The plan of the service (optional). If null
, the service plan is ignored when retrieving the
service credentials, i.e., only one binding must exist to the service.JsonObject
for the XSUAA credentials.CloudPlatformException
- If there is an issue accessing the service credentials.NoServiceBindingException
- If there is no binding to the XSUAA service.MultipleServiceBindingsException
- If there are multiple bindings to the XSUAA service.@Nonnull public List<com.google.gson.JsonObject> getXsuaaServiceCredentialsList() throws CloudPlatformException
JsonObject
containing the credentials for all bound XSUAA service instances.CloudPlatformException
- If there is an issue accessing the service credentials.@Nonnull public com.google.gson.JsonObject getXsuaaServiceCredentials(@Nonnull com.auth0.jwt.interfaces.DecodedJWT jwt) throws CloudPlatformException, NoServiceBindingException, MultipleServiceBindingsException
jwt
- The JWT for which to return the matching XSUAA service instance credentials.JsonObject
for the XSUAA service credentials.CloudPlatformException
- If there is an issue accessing the service credentials.NoServiceBindingException
- If there is no matching binding to a XSUAA service instance.MultipleServiceBindingsException
- If there are multiple bindings to matching XSUAA service instances.@Nonnull public com.google.gson.JsonObject getDestinationServiceCredentials() throws CloudPlatformException, NoServiceBindingException, MultipleServiceBindingsException
JsonObject
for the destination service credentials.CloudPlatformException
- If there is an issue accessing the service credentials.NoServiceBindingException
- If there is no binding to the destination service.MultipleServiceBindingsException
- If there are multiple bindings to the destination service.@Nonnull public List<com.google.gson.JsonObject> getDestinationServiceCredentialsList() throws CloudPlatformException
JsonObject
containing the credentials for all bound destination service instances.CloudPlatformException
- If there is an issue accessing the service credentials.@Nonnull public com.google.gson.JsonObject getConnectivityServiceCredentials() throws CloudPlatformException, NoServiceBindingException, MultipleServiceBindingsException
JsonObject
for the connectivity service credentials.CloudPlatformException
- If there is an issue accessing the service credentials.NoServiceBindingException
- If there is no binding to the connectivity service.MultipleServiceBindingsException
- If there are multiple bindings to the connectivity service.@Nonnull public List<com.google.gson.JsonObject> getConnectivityServiceCredentialsList() throws CloudPlatformException
JsonObject
containing the credentials for all bound connectivity service instances.CloudPlatformException
- If there is an issue accessing the service credentials.Copyright © 2019 SAP SE. All rights reserved.