ServiceT
- the service subclassOptionsT
- the ServiceOptions
subclass corresponding to the servicepublic abstract class ServiceOptions<ServiceT extends Service<OptionsT>,OptionsT extends ServiceOptions<ServiceT,OptionsT>> extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
ServiceOptions.Builder<ServiceT extends Service<OptionsT>,OptionsT extends ServiceOptions<ServiceT,OptionsT>,B extends ServiceOptions.Builder<ServiceT,OptionsT,B>>
Builder for
ServiceOptions . |
Modifier and Type | Field and Description |
---|---|
static String |
CREDENTIAL_ENV_NAME |
protected Credentials |
credentials |
Modifier | Constructor and Description |
---|---|
protected |
ServiceOptions(Class<? extends ServiceFactory<ServiceT,OptionsT>> serviceFactoryClass,
Class<? extends ServiceRpcFactory<OptionsT>> rpcFactoryClass,
ServiceOptions.Builder<ServiceT,OptionsT,?> builder,
ServiceDefaults<ServiceT,OptionsT> serviceDefaults) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
baseEquals(ServiceOptions<?,?> other) |
protected int |
baseHashCode() |
protected RetrySettings |
defaultRetrySettings()
Some services may have different backoff requirements listed in their SLAs.
|
static String |
getAppEngineAppId() |
protected static String |
getAppEngineProjectId() |
protected static String |
getAppEngineProjectIdFromAppId() |
String |
getApplicationName()
Returns the application's name as a string in the format
gcloud-java/[version] ,
optionally prepended with externally supplied User-Agent header value (via setting custom
header provider). |
com.google.api.core.ApiClock |
getClock()
Returns the service's clock.
|
Credentials |
getCredentials()
Returns the authentication credentials.
|
protected String |
getDefaultHost() |
protected String |
getDefaultProject() |
static String |
getDefaultProjectId()
Returns the default project ID, or
null if no default project ID could be found. |
static RetrySettings |
getDefaultRetrySettings() |
static <T> T |
getFromServiceLoader(Class<? extends T> clazz,
T defaultInstance) |
static String |
getGoogApiClientLibName()
Returns the library's name used by x-goog-api-client header as a string.
|
protected static String |
getGoogleCloudProjectId() |
String |
getHost()
Returns the service host.
|
static String |
getLibraryName()
Returns the library's name,
gcloud-java , as a string. |
String |
getLibraryVersion()
Returns the library's version as a string.
|
HeaderProvider |
getMergedHeaderProvider(HeaderProvider internalHeaderProvider) |
static RetrySettings |
getNoRetrySettings() |
String |
getProjectId()
Returns the project ID.
|
RetrySettings |
getRetrySettings()
Returns configuration parameters for request retries.
|
ServiceRpc |
getRpc()
Returns a Service RPC object for the current service.
|
Credentials |
getScopedCredentials()
Returns the authentication credentials.
|
protected abstract Set<String> |
getScopes() |
ServiceT |
getService()
Returns a Service object for the current service.
|
protected static String |
getServiceAccountProjectId() |
TransportOptions |
getTransportOptions()
Returns the transport-specific options for this service.
|
String |
getUserAgent() |
static <T> T |
newInstance(String className) |
protected boolean |
projectIdRequired()
Returns whether a service requires a project ID.
|
abstract <B extends ServiceOptions.Builder<ServiceT,OptionsT,B>> |
toBuilder() |
public static final String CREDENTIAL_ENV_NAME
protected Credentials credentials
@InternalApi(value="This class should only be extended within google-cloud-java") protected ServiceOptions(Class<? extends ServiceFactory<ServiceT,OptionsT>> serviceFactoryClass, Class<? extends ServiceRpcFactory<OptionsT>> rpcFactoryClass, ServiceOptions.Builder<ServiceT,OptionsT,?> builder, ServiceDefaults<ServiceT,OptionsT> serviceDefaults)
protected boolean projectIdRequired()
protected String getDefaultHost()
protected String getDefaultProject()
public static String getDefaultProjectId()
null
if no default project ID could be found. This
method returns the first available project ID among the following sources:
GOOGLE_APPLICATION_CREDENTIALS
environment variable
public static String getAppEngineAppId()
protected static String getGoogleCloudProjectId()
protected static String getAppEngineProjectId()
protected static String getAppEngineProjectIdFromAppId()
protected static String getServiceAccountProjectId()
public ServiceT getService()
public ServiceRpc getRpc()
public String getProjectId()
public String getHost()
public Credentials getCredentials()
public Credentials getScopedCredentials()
public RetrySettings getRetrySettings()
public com.google.api.core.ApiClock getClock()
System.currentTimeMillis()
to get
current time.public TransportOptions getTransportOptions()
public String getApplicationName()
gcloud-java/[version]
,
optionally prepended with externally supplied User-Agent header value (via setting custom
header provider).public static String getLibraryName()
gcloud-java
, as a string.public static String getGoogApiClientLibName()
public String getLibraryVersion()
@InternalApi public final HeaderProvider getMergedHeaderProvider(HeaderProvider internalHeaderProvider)
@InternalApi public final String getUserAgent()
protected int baseHashCode()
protected boolean baseEquals(ServiceOptions<?,?> other)
@InternalApi public static <T> T newInstance(String className) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static RetrySettings getDefaultRetrySettings()
public static RetrySettings getNoRetrySettings()
public abstract <B extends ServiceOptions.Builder<ServiceT,OptionsT,B>> B toBuilder()
protected RetrySettings defaultRetrySettings()
RetrySettings
.@InternalApi public static <T> T getFromServiceLoader(Class<? extends T> clazz, T defaultInstance)
Copyright © 2019 Google LLC. All rights reserved.