Package io.littlehorse.sdk.common.config
Class LHClientConfig
- java.lang.Object
-
- io.littlehorse.sdk.common.config.ConfigBase
-
- io.littlehorse.sdk.common.config.LHClientConfig
-
- Direct Known Subclasses:
LHWorkerConfig
public class LHClientConfig extends io.littlehorse.sdk.common.config.ConfigBaseThis class is used to configure the LHClient class.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringAPI_HOST_KEYThe bootstrap host for the LH Server.static java.lang.StringAPI_PORT_KEYThe bootstrap port for the LH Server.static java.lang.StringCA_CERT_KEYOptional location of CA Cert File.static java.lang.StringCLIENT_CERT_KEYOptional location of Client Cert file.static java.lang.StringCLIENT_ID_KEYThe Client Id.static java.lang.StringCLIENT_KEY_KEYOptional location of Client Private Key File.static java.lang.StringOAUTH_AUTHORIZATION_SERVER_KEYstatic java.lang.StringOAUTH_CLIENT_ID_KEYstatic java.lang.StringOAUTH_CLIENT_SECRET_KEY
-
Constructor Summary
Constructors Constructor Description LHClientConfig()Creates an LHClientConfig.LHClientConfig(java.lang.String propLocation)Creates an LHClientConfig with config props in a specified .properties file.LHClientConfig(java.util.Map<java.lang.String,java.lang.Object> configs)Creates an LHClientConfig with provided config values.LHClientConfig(java.util.Properties props)Creates an LHClientConfig with provided config values.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.Set<java.lang.String>configNames()Returns a set of all config names.java.lang.StringgetApiBootstrapHost()intgetApiBootstrapPort()io.littlehorse.sdk.common.proto.LHPublicApiGrpc.LHPublicApiStubgetAsyncStub()Gets an Async gRPC stub for the LH Public API on the configured host/port, which is generally the loadbalancer url.io.littlehorse.sdk.common.proto.LHPublicApiGrpc.LHPublicApiStubgetAsyncStub(java.lang.String host, int port)Gets an Async gRPC stub for the LH Public API on a specified host and port.io.littlehorse.sdk.common.proto.LHPublicApiGrpc.LHPublicApiBlockingStubgetBlockingStub()Gets a Blocking gRPC stub for the LH Public API on the configured host/port, which is generally the loadbalancer url.io.littlehorse.sdk.common.proto.LHPublicApiGrpc.LHPublicApiBlockingStubgetBlockingStub(java.lang.String host, int port)Gets a Blocking gRPC stub for the LH Public API on a specified host and port.java.lang.StringgetClientId()booleanisOauth()
-
-
-
Field Detail
-
API_HOST_KEY
public static final java.lang.String API_HOST_KEY
The bootstrap host for the LH Server.- See Also:
- Constant Field Values
-
API_PORT_KEY
public static final java.lang.String API_PORT_KEY
The bootstrap port for the LH Server.- See Also:
- Constant Field Values
-
CLIENT_ID_KEY
public static final java.lang.String CLIENT_ID_KEY
The Client Id.- See Also:
- Constant Field Values
-
CLIENT_CERT_KEY
public static final java.lang.String CLIENT_CERT_KEY
Optional location of Client Cert file.- See Also:
- Constant Field Values
-
CLIENT_KEY_KEY
public static final java.lang.String CLIENT_KEY_KEY
Optional location of Client Private Key File.- See Also:
- Constant Field Values
-
CA_CERT_KEY
public static final java.lang.String CA_CERT_KEY
Optional location of CA Cert File.- See Also:
- Constant Field Values
-
OAUTH_CLIENT_ID_KEY
public static final java.lang.String OAUTH_CLIENT_ID_KEY
- See Also:
- Constant Field Values
-
OAUTH_CLIENT_SECRET_KEY
public static final java.lang.String OAUTH_CLIENT_SECRET_KEY
- See Also:
- Constant Field Values
-
OAUTH_AUTHORIZATION_SERVER_KEY
public static final java.lang.String OAUTH_AUTHORIZATION_SERVER_KEY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LHClientConfig
public LHClientConfig()
Creates an LHClientConfig. Loads default values for config from env vars.
-
LHClientConfig
public LHClientConfig(java.util.Properties props)
Creates an LHClientConfig with provided config values.- Parameters:
props- configuration values.
-
LHClientConfig
public LHClientConfig(java.lang.String propLocation)
Creates an LHClientConfig with config props in a specified .properties file.- Parameters:
propLocation- the location of the .properties file.
-
LHClientConfig
public LHClientConfig(java.util.Map<java.lang.String,java.lang.Object> configs)
Creates an LHClientConfig with provided config values.- Parameters:
configs- configuration values.
-
-
Method Detail
-
configNames
public static java.util.Set<java.lang.String> configNames()
Returns a set of all config names.- Returns:
- A Set of all config names.
-
getBlockingStub
public io.littlehorse.sdk.common.proto.LHPublicApiGrpc.LHPublicApiBlockingStub getBlockingStub() throws java.io.IOExceptionGets a Blocking gRPC stub for the LH Public API on the configured host/port, which is generally the loadbalancer url.- Returns:
- a blocking gRPC stub for the configured host/port.
- Throws:
java.io.IOException- if stub creation fails.
-
getAsyncStub
public io.littlehorse.sdk.common.proto.LHPublicApiGrpc.LHPublicApiStub getAsyncStub() throws java.io.IOExceptionGets an Async gRPC stub for the LH Public API on the configured host/port, which is generally the loadbalancer url.- Returns:
- an async gRPC stub for the configured host/port.
- Throws:
java.io.IOException- if stub creation fails.
-
getAsyncStub
public io.littlehorse.sdk.common.proto.LHPublicApiGrpc.LHPublicApiStub getAsyncStub(java.lang.String host, int port) throws java.io.IOExceptionGets an Async gRPC stub for the LH Public API on a specified host and port. Generally used by the Task Worker, which needs to connect directly to a specific LH Server rather than the bootstrap host (loadbalancer).- Parameters:
host- is the host that the LH Server lives on.port- is the port that the LH Server lives on.- Returns:
- an async gRPC stub for that host/port combo.
- Throws:
java.io.IOException- if stub creation fails.
-
getBlockingStub
public io.littlehorse.sdk.common.proto.LHPublicApiGrpc.LHPublicApiBlockingStub getBlockingStub(java.lang.String host, int port) throws java.io.IOExceptionGets a Blocking gRPC stub for the LH Public API on a specified host and port. Generally used by the Task Worker, which needs to connect directly to a specific LH Server rather than the bootstrap host (loadbalancer).- Parameters:
host- is the host that the LH Server lives on.port- is the port that the LH Server lives on.- Returns:
- a blocking gRPC stub for that host/port combo.
- Throws:
java.io.IOException- if stub creation fails.
-
getApiBootstrapHost
public java.lang.String getApiBootstrapHost()
-
getApiBootstrapPort
public int getApiBootstrapPort()
-
getClientId
public java.lang.String getClientId()
-
isOauth
public boolean isOauth()
-
-