use of com.github.isdream.jointware.kubernetes.KubernetesModelGenerator in project jointware by isdream.
the class KubernetesExecutor method doCreateOrReplace.
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Object doCreateOrReplace(Object client, String kind, Map<String, Map<String, Object>> params) throws Exception {
CreateOrReplaceable instance = (CreateOrReplaceable) getKindModel(client, kind);
KubernetesModelGenerator generator = new KubernetesModelGenerator(getObjectRef());
Object param = generator.toObject(params, kind);
return instance.createOrReplace(param);
}
use of com.github.isdream.jointware.kubernetes.KubernetesModelGenerator in project jointware by isdream.
the class KubernetesExecutor method doCreate.
/**
**********************************************************************************
*
***********************************************************************************
*/
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Object doCreate(Object client, String kind, Map<String, Map<String, Object>> params) throws Exception {
Createable instance = (Createable) getKindModel(client, kind);
KubernetesModelGenerator generator = new KubernetesModelGenerator(getObjectRef());
Object param = generator.toObject(params, kind);
return instance.create(param);
}
use of com.github.isdream.jointware.kubernetes.KubernetesModelGenerator in project jointware by isdream.
the class JSONToExecutorSampleTest method main.
/**
********************************************
*
* Main
*
*********************************************
*/
public static void main(String[] args) throws Exception {
// JsonToMap
Map<String, Map<String, Object>> originRequest = getClientRequest();
// getClient
DefaultKubernetesClient client = (DefaultKubernetesClient) createClient(originRequest.get("target"));
// toTartgetMap
Map<String, Map<String, Object>> targetRequest = toTargetMap(originRequest, "jointwareRef");
// option : test
ModelGenerator mg = new KubernetesModelGenerator();
System.out.println(mg.toObject(targetRequest, Deployment.class.getSimpleName()));
// getExcutor
ConatinerExecutor executor = (ConatinerExecutor) createExecutor(originRequest.get("target"));
// impl
// executor.create(client, getKind(originRequest.remove("target")), targetRequest);
}
use of com.github.isdream.jointware.kubernetes.KubernetesModelGenerator in project jointware by isdream.
the class SimpleSampleTest method main.
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
ConatinerExecutor dp = new KubernetesExecutor();
// dp.create(createClient(), Namespace.class.getSimpleName(), getParams(NAMESPACE));
// System.out.println(dp.query(createClient(), Namespace.class.getSimpleName(), "development"));
// dp.create(createClient(), Deployment.class.getSimpleName(), getParams(DEPLOYMENT));
// System.out.println( getParams(DEPLOYMENT));
KubernetesModelGenerator gr = new KubernetesModelGenerator();
// System.out.println(gr.toObject(getParams(NAMESPACE), Namespace.class.getSimpleName()));
System.out.println(gr.toObject(getParams(DEPLOYMENT), Deployment.class.getSimpleName()));
}
Aggregations