com.palantir.atlasdb.timelock.lock.watch.ConjureLockWatchDiagnosticsServiceAsync Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of timelock-api-dialogue Show documentation
Show all versions of timelock-api-dialogue Show documentation
Palantir open source project
package com.palantir.atlasdb.timelock.lock.watch;
import com.google.common.util.concurrent.ListenableFuture;
import com.palantir.conjure.java.lib.internal.ClientEndpoint;
import com.palantir.dialogue.Channel;
import com.palantir.dialogue.ConjureRuntime;
import com.palantir.dialogue.Deserializer;
import com.palantir.dialogue.DialogueService;
import com.palantir.dialogue.DialogueServiceFactory;
import com.palantir.dialogue.Endpoint;
import com.palantir.dialogue.EndpointChannel;
import com.palantir.dialogue.EndpointChannelFactory;
import com.palantir.dialogue.PlainSerDe;
import com.palantir.dialogue.Request;
import com.palantir.logsafe.Safe;
import com.palantir.tokens.auth.AuthHeader;
import java.lang.Override;
import java.lang.String;
import java.lang.Void;
import javax.annotation.processing.Generated;
@Generated("com.palantir.conjure.java.services.dialogue.DialogueInterfaceGenerator")
@DialogueService(ConjureLockWatchDiagnosticsServiceAsync.Factory.class)
public interface ConjureLockWatchDiagnosticsServiceAsync {
/** @apiNote {@code POST /lw/diagnostics/logState/{namespace}} */
@ClientEndpoint(method = "POST", path = "/lw/diagnostics/logState/{namespace}")
ListenableFuture logState(AuthHeader authHeader, @Safe String namespace);
/** Creates an asynchronous/non-blocking client for a ConjureLockWatchDiagnosticsService service. */
static ConjureLockWatchDiagnosticsServiceAsync of(
EndpointChannelFactory _endpointChannelFactory, ConjureRuntime _runtime) {
return new ConjureLockWatchDiagnosticsServiceAsync() {
private final PlainSerDe _plainSerDe = _runtime.plainSerDe();
private final EndpointChannel logStateChannel =
_endpointChannelFactory.endpoint(DialogueConjureLockWatchDiagnosticsEndpoints.logState);
private final Deserializer logStateDeserializer =
_runtime.bodySerDe().emptyBodyDeserializer();
@Override
public ListenableFuture logState(AuthHeader authHeader, String namespace) {
Request.Builder _request = Request.builder();
_request.putHeaderParams("Authorization", authHeader.toString());
_request.putPathParams("namespace", _plainSerDe.serializeString(namespace));
return _runtime.clients().call(logStateChannel, _request.build(), logStateDeserializer);
}
@Override
public String toString() {
return "ConjureLockWatchDiagnosticsServiceAsync{_endpointChannelFactory=" + _endpointChannelFactory
+ ", runtime=" + _runtime + '}';
}
};
}
/** Creates an asynchronous/non-blocking client for a ConjureLockWatchDiagnosticsService service. */
static ConjureLockWatchDiagnosticsServiceAsync of(Channel _channel, ConjureRuntime _runtime) {
if (_channel instanceof EndpointChannelFactory) {
return of((EndpointChannelFactory) _channel, _runtime);
}
return of(
new EndpointChannelFactory() {
@Override
public EndpointChannel endpoint(Endpoint endpoint) {
return _runtime.clients().bind(_channel, endpoint);
}
},
_runtime);
}
final class Factory implements DialogueServiceFactory {
@Override
public ConjureLockWatchDiagnosticsServiceAsync create(
EndpointChannelFactory endpointChannelFactory, ConjureRuntime runtime) {
return ConjureLockWatchDiagnosticsServiceAsync.of(endpointChannelFactory, runtime);
}
}
}