All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.palantir.atlasdb.backup.api.AtlasBackupClientBlocking Maven / Gradle / Ivy

There is a newer version: 0.1152.0
Show newest version
package com.palantir.atlasdb.backup.api;

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.dialogue.Serializer;
import com.palantir.dialogue.TypeMarker;
import com.palantir.tokens.auth.AuthHeader;
import java.lang.Override;
import java.lang.String;
import javax.annotation.Generated;

@Generated("com.palantir.conjure.java.services.dialogue.DialogueInterfaceGenerator")
@DialogueService(AtlasBackupClientBlocking.Factory.class)
public interface AtlasBackupClientBlocking {
    /**
     * @apiNote {@code POST /backup/prepare}
     */
    @ClientEndpoint(method = "POST", path = "/backup/prepare")
    PrepareBackupResponse prepareBackup(AuthHeader authHeader, PrepareBackupRequest request);

    /**
     * @apiNote {@code POST /backup/complete}
     */
    @ClientEndpoint(method = "POST", path = "/backup/complete")
    CompleteBackupResponse completeBackup(AuthHeader authHeader, CompleteBackupRequest request);

    /**
     * Creates a synchronous/blocking client for a AtlasBackupClient service.
     */
    static AtlasBackupClientBlocking of(EndpointChannelFactory _endpointChannelFactory, ConjureRuntime _runtime) {
        return new AtlasBackupClientBlocking() {
            private final PlainSerDe _plainSerDe = _runtime.plainSerDe();

            private final Serializer prepareBackupSerializer =
                    _runtime.bodySerDe().serializer(new TypeMarker() {});

            private final EndpointChannel prepareBackupChannel =
                    _endpointChannelFactory.endpoint(DialogueAtlasBackupClientEndpoints.prepareBackup);

            private final Deserializer prepareBackupDeserializer =
                    _runtime.bodySerDe().deserializer(new TypeMarker() {});

            private final Serializer completeBackupSerializer =
                    _runtime.bodySerDe().serializer(new TypeMarker() {});

            private final EndpointChannel completeBackupChannel =
                    _endpointChannelFactory.endpoint(DialogueAtlasBackupClientEndpoints.completeBackup);

            private final Deserializer completeBackupDeserializer =
                    _runtime.bodySerDe().deserializer(new TypeMarker() {});

            @Override
            public PrepareBackupResponse prepareBackup(AuthHeader authHeader, PrepareBackupRequest request) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.body(prepareBackupSerializer.serialize(request));
                return _runtime.clients()
                        .callBlocking(prepareBackupChannel, _request.build(), prepareBackupDeserializer);
            }

            @Override
            public CompleteBackupResponse completeBackup(AuthHeader authHeader, CompleteBackupRequest request) {
                Request.Builder _request = Request.builder();
                _request.putHeaderParams("Authorization", authHeader.toString());
                _request.body(completeBackupSerializer.serialize(request));
                return _runtime.clients()
                        .callBlocking(completeBackupChannel, _request.build(), completeBackupDeserializer);
            }

            @Override
            public String toString() {
                return "AtlasBackupClientBlocking{_endpointChannelFactory=" + _endpointChannelFactory + ", runtime="
                        + _runtime + '}';
            }
        };
    }

    /**
     * Creates an asynchronous/non-blocking client for a AtlasBackupClient service.
     */
    static AtlasBackupClientBlocking 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 AtlasBackupClientBlocking create(EndpointChannelFactory endpointChannelFactory, ConjureRuntime runtime) {
            return AtlasBackupClientBlocking.of(endpointChannelFactory, runtime);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy