public final class CredentialUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
CredentialUtils.ServiceCredentials
A util class to easily store service credentials.
|
Modifier and Type | Field and Description |
---|---|
static String |
PLAN_EXPERIMENTAL
The Constant PLAN_EXPERIMENTAL.
|
static String |
PLAN_FREE
The Constant PLAN_FREE.
|
static String |
PLAN_STANDARD
The Constant PLAN_STANDARD.
|
Modifier and Type | Method and Description |
---|---|
static String |
getAPIKey(String serviceName)
Returns the apiKey from the VCAP_SERVICES or null if doesn't exists.
|
static String |
getAPIKey(String serviceName,
String plan)
Returns the apiKey from the VCAP_SERVICES or null if doesn't exists.
|
static String |
getAPIUrl(String serviceName)
Gets the API url.
|
static String |
getAPIUrl(String serviceName,
String plan)
Returns the apiKey from the VCAP_SERVICES or null if doesn't exists.
|
static CredentialUtils.ServiceCredentials |
getUserNameAndPassword(String serviceName)
Returns the username and password as defined in the VCAP_SERVICES or null if they do not exist or are not
accessible.
|
static CredentialUtils.ServiceCredentials |
getUserNameAndPassword(String serviceName,
String plan)
Returns the username and password as defined in the VCAP_SERVICES or null if they do not exist or are not
accessible.
|
static void |
setServices(String services)
Sets the VCAP_SERVICES variable.
|
public static final String PLAN_EXPERIMENTAL
public static final String PLAN_FREE
public static final String PLAN_STANDARD
public static String getAPIKey(String serviceName)
serviceName
- the service namepublic static String getAPIKey(String serviceName, String plan)
serviceName
- the service nameplan
- the service plan: standard, free or experimentalpublic static CredentialUtils.ServiceCredentials getUserNameAndPassword(String serviceName)
getUserNameAndPassword(String, String)
. Invoking this method is
identical to calling getUserNameAndPassword(serviceName, null);
serviceName
- the name of the service whose credentials are soughtpublic static CredentialUtils.ServiceCredentials getUserNameAndPassword(String serviceName, String plan)
serviceName
- the name of the service whose credentials are soughtplan
- the plan namepublic static String getAPIUrl(String serviceName)
serviceName
- the service namepublic static String getAPIUrl(String serviceName, String plan)
serviceName
- the service nameplan
- the service plan: standard, free or experimentalpublic static void setServices(String services)
services
- the VCAP_SERVICESCopyright © 2015–2016 IBM Watson. All rights reserved.