Package org.apache.storm.utils
Class NimbusClient
java.lang.Object
org.apache.storm.security.auth.ThriftClient
org.apache.storm.utils.NimbusClient
- All Implemented Interfaces:
AutoCloseable
Client used for connecting to nimbus. Typically you want to use a variant of the
`getConfiguredClient` static method to get a client to use, as directly putting in
a host and port does not support nimbus high availability.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final classstatic interfaceAn interface to allow callbacks with a thrift nimbus client. -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal booleanIndicates if this is a special client that is overwritten for local mode.Fields inherited from class org.apache.storm.security.auth.ThriftClient
protocol, retryForever -
Constructor Summary
ConstructorsConstructorDescriptionNimbusClient(Map<String, Object> conf, String host) Deprecated.Deprecated.use#buildWithNimbusHostPort()instead.Deprecated.use#buildWithNimbusHostPort()instead.NimbusClient(Map<String, Object> conf, String host, Integer port, Integer timeout, String asUser, boolean useTls) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionGet the underlying thrift client.static NimbusClientgetConfiguredClient(Map<String, Object> conf) Deprecated.use#build()instead.static NimbusClientgetConfiguredClient(Map<String, Object> conf, Integer timeout) Deprecated.use#build()instead.static NimbusClientgetConfiguredClientAs(Map<String, Object> conf, String asUser) Deprecated.use#build()instead.static NimbusClientDeprecated.use#build()instead.static booleanIs the local override set or not.static voidExecute cb with a configured nimbus client that will be closed once cb returns.static voidwithConfiguredClient(NimbusClient.WithNimbus cb, Map<String, Object> conf) Execute cb with a configured nimbus client that will be closed once cb returns.Methods inherited from class org.apache.storm.security.auth.ThriftClient
close, getKeyStoreFile, getPrivateKey, reconnect, transport
-
Field Details
-
isLocal
public final boolean isLocalIndicates if this is a special client that is overwritten for local mode.
-
-
Constructor Details
-
NimbusClient
@Deprecated public NimbusClient(Map<String, Object> conf, String host, int port, Integer timeout) throws org.apache.storm.thrift.transport.TTransportExceptionDeprecated.use#buildWithNimbusHostPort()instead.Constructor.- Parameters:
conf- the conf for the client.host- the host the client is to talk to.port- the port the client is to talk to.timeout- the timeout to use when connecting.- Throws:
org.apache.storm.thrift.transport.TTransportException- on any error.
-
NimbusClient
@Deprecated public NimbusClient(Map<String, Object> conf, String host, Integer port, Integer timeout, String asUser) throws org.apache.storm.thrift.transport.TTransportExceptionDeprecated.use#buildWithNimbusHostPort()instead.Constructor.- Parameters:
conf- the conf for the client.host- the host the client is to talk to.port- the port the client is to talk to.timeout- the timeout to use when connecting.asUser- the name of the user you want to impersonate (use with caution as it is not always supported).- Throws:
org.apache.storm.thrift.transport.TTransportException- on any error.
-
NimbusClient
@Deprecated public NimbusClient(Map<String, Object> conf, String host, Integer port, Integer timeout, String asUser, boolean useTls) throws org.apache.storm.thrift.transport.TTransportExceptionDeprecated.- Throws:
org.apache.storm.thrift.transport.TTransportException
-
NimbusClient
@Deprecated public NimbusClient(Map<String, Object> conf, String host) throws org.apache.storm.thrift.transport.TTransportExceptionDeprecated.use#buildWithNimbusHostPort()instead.Constructor.- Parameters:
conf- the conf for the client.host- the host the client is to talk to.- Throws:
org.apache.storm.thrift.transport.TTransportException- on any error.
-
-
Method Details
-
isLocalOverride
public static boolean isLocalOverride()Is the local override set or not.- Returns:
- true of new clients will be overridden to connect to a local cluster and not the configured remote cluster.
-
withConfiguredClient
Execute cb with a configured nimbus client that will be closed once cb returns.- Parameters:
cb- the callback to send to nimbus.- Throws:
Exception- on any kind of error.
-
withConfiguredClient
public static void withConfiguredClient(NimbusClient.WithNimbus cb, Map<String, Object> conf) throws ExceptionExecute cb with a configured nimbus client that will be closed once cb returns.- Parameters:
cb- the callback to send to nimbus.conf- the conf to use instead of reading the global storm conf.- Throws:
Exception- on any kind of error.
-
getConfiguredClient
Deprecated.use#build()instead.Get a nimbus client as configured by conf.- Parameters:
conf- the configuration to use.- Returns:
- the client, don't forget to close it when done.
-
getConfiguredClient
@Deprecated public static NimbusClient getConfiguredClient(Map<String, Object> conf, Integer timeout) Deprecated.use#build()instead.Get a nimbus client as configured by conf.- Parameters:
conf- the configuration to use.timeout- the timeout to use when connecting.- Returns:
- the client, don't forget to close it when done.
-
getConfiguredClientAs
@Deprecated public static NimbusClient getConfiguredClientAs(Map<String, Object> conf, String asUser) Deprecated.use#build()instead.Get a nimbus client as configured by conf.- Parameters:
conf- the configuration to use.asUser- the user to impersonate (this does not always work).- Returns:
- the client, don't forget to close it when done.
-
getConfiguredClientAs
@Deprecated public static NimbusClient getConfiguredClientAs(Map<String, Object> conf, String asUser, Integer timeout) Deprecated.use#build()instead.Get a nimbus client as configured by conf.- Parameters:
conf- the configuration to use.asUser- the user to impersonate (this does not always work).timeout- the timeout to use when connecting.- Returns:
- the client, don't forget to close it when done.
-
getClient
Get the underlying thrift client.- Returns:
- the underlying thrift client.
-
#buildWithNimbusHostPort()instead.