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

com.taobao.drc.clusterclient.clustermanager.BatchGetPartitionRequest Maven / Gradle / Ivy

There is a newer version: 5.0.0.1.beta
Show newest version
package com.taobao.drc.clusterclient.clustermanager;

import com.alibaba.fastjson.JSON;
import com.taobao.drc.clusterclient.partition.PartitionRef;
import org.apache.http.client.config.RequestConfig;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yangyang
 * @since 17/6/20
 */
public class BatchGetPartitionRequest extends AbstractControllerRequest {
    static final String API_VERSION = "1.0";
    private static final RequestConfig REQUEST_CONFIG = RequestConfig.custom()
            .setConnectTimeout(60 * 1000)
            .setConnectionRequestTimeout(60 * 1000)
            .setSocketTimeout(60 * 1000)
            .build();

    private List partitionRefs = new ArrayList();

    @Override
    public String getAPIVersion() {
        return API_VERSION;
    }

    @Override
    public String getPath() {
        return PatternUrlConstant.PATH_BATCH_GET_PARTITIONS;
    }

    @Override
    public String getContent() {
        return JSON.toJSONString(partitionRefs);
    }

    @Override
    public RequestConfig getRequestConfig() {
        return REQUEST_CONFIG;
    }

    public BatchGetPartitionRequest addPartition(String guid, String group, String partition) {
        this.partitionRefs.add(new PartitionRef(guid, group, partition));
        return this;
    }

    public List getPartitionRefs() {
        return partitionRefs;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy