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

com.aliyun.openservices.log.request.UpsertResourceRecordRequest Maven / Gradle / Ivy

There is a newer version: 0.6.115
Show newest version
package com.aliyun.openservices.log.request;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aliyun.openservices.log.common.Consts;
import com.aliyun.openservices.log.common.ResourceRecord;

import java.util.Collections;
import java.util.List;


public class UpsertResourceRecordRequest extends RecordRequest {
    private List records;

    public UpsertResourceRecordRequest(String resourceName, ResourceRecord record) {
        this(resourceName, Collections.singletonList(record));
    }

    public UpsertResourceRecordRequest(String resourceName, List records) {
        super(resourceName);
        this.records = records;
    }

    public String getPostBody() {
        JSONObject result = new JSONObject();
        JSONArray encodedRecords = new JSONArray();
        encodedRecords.addAll(records);
        result.put(Consts.RESOURCE_RECORDS, encodedRecords);
        return result.toString();
    }

    public List getRecords() {
        return records;
    }

    public void setRecords(List records) {
        this.records = records;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy