Search in sources :

Example 11 with UnitResponse

use of info.xiancloud.core.message.UnitResponse in project xian by happyyangyuan.

the class App method deleteInstances.

// ---------服务实例相关接口
/**
 * 删除服务实例
 */
static void deleteInstances() {
    // description
    // Man.serial();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("clusterId", "cls-768pakpq");
    // 服务实例列表数组
    JSONArray instances = new JSONArray();
    instances.add("my-mongodb-3632199888-dwpeo");
    // instances.add("my-mongodb-3632199888-jjoqx");
    params.put("instances.n", instances.toJSONString());
    UnitResponse result = SyncXian.call("qcloudContainerService", "deleteInstances", params);
    System.out.println(result.getData().toString());
}
Also used : HashMap(java.util.HashMap) UnitResponse(info.xiancloud.core.message.UnitResponse) JSONArray(com.alibaba.fastjson.JSONArray) JSONObject(com.alibaba.fastjson.JSONObject)

Example 12 with UnitResponse

use of info.xiancloud.core.message.UnitResponse in project xian by happyyangyuan.

the class App method resumeClusterService.

/**
 * 继续服务更新
 */
static void resumeClusterService() {
    // description
    // Man.serial();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("clusterId", "cls-768pakpq");
    params.put("serviceName", "my-mongodb");
    UnitResponse result = SyncXian.call("qcloudContainerService", "resumeClusterService", params);
    System.out.println(result.getData().toString());
}
Also used : HashMap(java.util.HashMap) UnitResponse(info.xiancloud.core.message.UnitResponse) JSONObject(com.alibaba.fastjson.JSONObject)

Example 13 with UnitResponse

use of info.xiancloud.core.message.UnitResponse in project xian by happyyangyuan.

the class App method describeClusterService.

/**
 * 查询服务列表
 */
static void describeClusterService() {
    // Man.serial();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("clusterId", "cls-768pakpq");
    params.put("namespace", "predev");
    // 展示所有命名空间下的服务
    // params.put("allnamespace", 1);
    UnitResponse result = SyncXian.call("qcloudContainerService", "describeClusterService", params);
    System.out.println(result.getData().toString());
}
Also used : HashMap(java.util.HashMap) UnitResponse(info.xiancloud.core.message.UnitResponse) JSONObject(com.alibaba.fastjson.JSONObject)

Example 14 with UnitResponse

use of info.xiancloud.core.message.UnitResponse in project xian by happyyangyuan.

the class App method createClusterService.

/**
 * 创建服务
 */
static void createClusterService() {
    // Man.serial();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("clusterId", "cls-768pakpq");
    params.put("serviceName", "my-mongodb");
    params.put("serviceDesc", "serverdec");
    // params.put("namespace", "xian");
    params.put("replicas", 2);
    // params.put("accessType","LoadBalancer");
    // 端口映射相关
    JSONArray portMappings = new JSONArray();
    JSONObject portMap = new JSONObject();
    portMap.put("lbPort", 80);
    portMap.put("containerPort", 80);
    // accessType=LoadBalancer 时,不需要传
    // portMap.put("nodePort", 36001);
    portMap.put("protocol", "TCP");
    portMappings.add(portMap);
    // ---容器相关-----
    JSONArray containers = new JSONArray();
    JSONObject objContain = new JSONObject();
    // 
    objContain.put("containerName", "mongodb");
    objContain.put("image", "mongo");
    containers.add(objContain);
    params.put("portMappings.n", portMappings.toJSONString());
    params.put("containers.n", containers.toJSONString());
    UnitResponse result = SyncXian.call("qcloudContainerService", "createClusterService", params);
    System.out.println(result.getData().toString());
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) HashMap(java.util.HashMap) UnitResponse(info.xiancloud.core.message.UnitResponse) JSONArray(com.alibaba.fastjson.JSONArray) JSONObject(com.alibaba.fastjson.JSONObject)

Example 15 with UnitResponse

use of info.xiancloud.core.message.UnitResponse in project xian by happyyangyuan.

the class App method modifyServiceReplicas.

/**
 * 修改实例服务副本数
 */
static void modifyServiceReplicas() {
    // description
    // Man.serial();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("clusterId", "cls-768pakpq");
    params.put("serviceName", "my-mongodb");
    params.put("scaleTo", 5);
    UnitResponse result = SyncXian.call("qcloudContainerService", "modifyServiceReplicas", params);
    System.out.println(result.getData().toString());
}
Also used : HashMap(java.util.HashMap) UnitResponse(info.xiancloud.core.message.UnitResponse) JSONObject(com.alibaba.fastjson.JSONObject)

Aggregations

UnitResponse (info.xiancloud.core.message.UnitResponse)106 JSONObject (com.alibaba.fastjson.JSONObject)74 HashMap (java.util.HashMap)22 UnitRequest (info.xiancloud.core.message.UnitRequest)17 NotifyHandler (info.xiancloud.core.NotifyHandler)16 JSONArray (com.alibaba.fastjson.JSONArray)9 Unit (info.xiancloud.core.Unit)6 UnitMeta (info.xiancloud.core.UnitMeta)6 CacheGroup (info.xiancloud.cache.service.CacheGroup)5 Group (info.xiancloud.core.Group)5 Input (info.xiancloud.core.Input)5 CountDownLatch (java.util.concurrent.CountDownLatch)5 Redis (info.xiancloud.cache.redis.Redis)4 CacheConfigBean (info.xiancloud.core.support.cache.CacheConfigBean)4 ThreadPoolManager (info.xiancloud.core.thread_pool.ThreadPoolManager)3 LOG (info.xiancloud.core.util.LOG)3 Set (java.util.Set)3 Test (org.junit.Test)3 MessageType (info.xiancloud.core.distribution.MessageType)2 UnitUndefinedException (info.xiancloud.core.distribution.exception.UnitUndefinedException)2