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

tech.ytsaurus.client.request.ResumeOperation Maven / Gradle / Ivy

The newest version!
package tech.ytsaurus.client.request;

import tech.ytsaurus.client.rpc.RpcClientRequestBuilder;
import tech.ytsaurus.core.GUID;
import tech.ytsaurus.rpcproxy.TReqResumeOperation;
import tech.ytsaurus.ysontree.YTreeBuilder;

/**
 * Request for resuming suspended operation
 *
 * @see 
 * resume_operation documentation
 * 
 * @see SuspendOperation
 */
public class ResumeOperation extends OperationReq
        implements HighLevelRequest {
    public ResumeOperation(BuilderBase builder) {
        super(builder);
    }

    public ResumeOperation(GUID operationId) {
        this(builder().setOperationId(operationId));
    }

    ResumeOperation(String operationAlias) {
        this(builder().setOperationAlias(operationAlias));
    }

    public static Builder builder() {
        return new Builder();
    }

    public static ResumeOperation fromAlias(String alias) {
        return new ResumeOperation(alias);
    }

    public YTreeBuilder toTree(YTreeBuilder builder) {
        return super.toTree(builder);
    }

    /**
     * Internal method: prepare request to send over network.
     */
    @Override
    public void writeTo(RpcClientRequestBuilder builder) {
        TReqResumeOperation.Builder messageBuilder = builder.body();
        writeOperationDescriptionToProto(messageBuilder::setOperationId, messageBuilder::setOperationAlias);
    }

    @Override
    public Builder toBuilder() {
        return builder()
                .setOperationId(operationId)
                .setOperationAlias(operationAlias)
                .setTimeout(timeout)
                .setRequestId(requestId)
                .setUserAgent(userAgent)
                .setTraceId(traceId, traceSampled)
                .setAdditionalData(additionalData);
    }

    public static class Builder extends BuilderBase {
        @Override
        protected Builder self() {
            return this;
        }
    }

    public abstract static class BuilderBase<
            TBuilder extends BuilderBase>
            extends OperationReq.Builder {
        protected BuilderBase() {
        }

        protected BuilderBase(BuilderBase builder) {
            super(builder);
        }

        public YTreeBuilder toTree(YTreeBuilder builder) {
            return super.toTree(builder);
        }

        @Override
        public ResumeOperation build() {
            return new ResumeOperation(this);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy