package com.bocloud.ims.interfaces.resource;

import com.alibaba.fastjson.JSONArray;
import com.bocloud.cmp.model.common.ApplicationParam;
import com.bocloud.cmp.model.common.CancelationParam;
import com.bocloud.cmp.model.common.ExtensionParam;
import com.bocloud.common.model.BocloudResult;
import com.bocloud.common.model.GridBean;
import com.bocloud.common.model.Pager;
import com.bocloud.common.model.RequestContext;
import com.bocloud.ims.entity.resource.LBAddBean;
import com.bocloud.ims.entity.resource.LoadBalancer;

import java.util.List;

/**
 * 负载均衡器service接口
 *
 * @author wangyu
 * @version 1.0
 * @since 2017年9月4日
 */
public interface LoadBalancerService {

	/**
	 * 查询负载均衡器列表
	 *
	 * @param pager
	 * @param context
	 * @return
	 */
	BocloudResult<GridBean<LoadBalancer>> list(Pager pager, RequestContext context);

	/**
	 * 创建负载均衡器
	 *
	 * @param bean
	 * @param context
	 * @return
	 */
	BocloudResult create(LBAddBean bean, RequestContext context);

	/**
	 * 修改负载均衡器信息
	 *
	 * @param balancer
	 * @param userId
	 * @return
	 */
	BocloudResult<LoadBalancer> modify(Long id, LBAddBean bean, Long userId);

	/**
	 * 查询负载均衡器信息
	 *
	 * @param id
	 * @return
	 */
	BocloudResult<LoadBalancer> detail(Long id);

	/**
	 * 删除负载均衡器
	 *
	 * @param id
	 * @param context
	 * @return
	 */
	BocloudResult remove(Long id, RequestContext context);

	/**
	 * 创建负载均衡器
	 *
	 * @param bean
	 * @param context
	 * @param callback
	 * @return
	 */
	BocloudResult create(LBAddBean bean, RequestContext context, String callback);

	/**
	 * 批量删除
	 *
	 * @param params
	 * @param context
	 * @return
	 */
	BocloudResult batchRemove(List<Long> idArray, RequestContext context);

	JSONArray getElbByParams(String envCode, String appSystemCode);

	BocloudResult labels(Long id, String labels, RequestContext context);

	BocloudResult listAvailableLbs(Long vendorId, String regionId, RequestContext context);

	/**
	 * 自服务申请
	 * 
	 * @param param
	 * @return
	 */
	BocloudResult<Void> apply(ApplicationParam param);

	/**
	 * 负载延期
	 * 
	 * @param parseObject
	 * @return
	 */
	BocloudResult extension(ExtensionParam parseObject);

	/**
	 * 负载退订
	 * 
	 * @param cancelation
	 * @return
	 */
	BocloudResult cancelation(CancelationParam cancelation);

}
