package com.bocloud.cmp.provider.security;

import com.bocloud.cmp.model.KeypairModel;
import com.bocloud.cmp.provider.SuperProvider;
import com.bocloud.common.model.BocloudResult;
import com.bocloud.common.utils.ResultTools;

/**
 * 密钥操作接口
 *
 * @author wangyu
 * @version 1.0
 * @since 2017年10月12日
 */
public interface KeypairProvider extends SuperProvider {
	@Override
	public boolean accessable();

	/**
	 * 查询密钥列表
	 *
	 * @return
	 */
	public BocloudResult list();

	/**
	 * 查询密钥详情
	 *
	 * @param keypairName
	 * @return
	 */
	public BocloudResult detail(String keypairName);

	/**
	 * 创建密钥
	 *
	 * @param keypairName
	 * @param publicKey
	 * @return
	 */
	public BocloudResult create(String keypairName, String publicKey);

	/**
	 * 删除密钥
	 *
	 * @param keypairName
	 * @return
	 */
	public BocloudResult delete(String keypairName);

	/**
	 * 秘钥修改
	 *
	 * @param model
	 * @return
	 */
	public BocloudResult modify(KeypairModel model);

	/**
	 * 创建密钥
	 *
	 * @param keypairName
	 * @param publicKey
	 * @param encryptMethod
	 * @return
	 */
	default BocloudResult create(String keypairName, String publicKey, String encryptMethod) {
		return ResultTools.noImplementedResult();
	}

	default BocloudResult list(String zone) {
		return null;
	}

	//azure-----
	default BocloudResult detail(KeypairModel model) {
		return new BocloudResult(false, "need implement");
	}

	default BocloudResult create(KeypairModel model) {
		return new BocloudResult(false, "need implement");
	}

	default BocloudResult delete(KeypairModel model) {
		return new BocloudResult(false, "need implement");
	}

}
