Search in sources :

Example 71 with UnitResponse

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

the class App method describeClusterServiceInfo.

/**
 * 查询服务详情
 */
static void describeClusterServiceInfo() {
    // Man.serial();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("clusterId", "cls-768pakpq");
    params.put("serviceName", "xiandb-dev");
    // params.put("namespace", "default");
    UnitResponse result = SyncXian.call("qcloudContainerService", "describeClusterServiceInfo", 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 72 with UnitResponse

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

the class App method modifyClusterServiceImage.

/**
 * 修改服务镜像
 */
public static void modifyClusterServiceImage() throws Exception {
    // description
    // Man.serial();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("clusterId", "cls-768pakpq");
    params.put("serviceName", "communication");
    // 实例下只有一个容器 直接传 image参数即可
    params.put("image", DeploymentUtil.REGISTRY_URI() + "xian_predev:jenkins-xian_predev-400");
    // 测试多多容器修改镜像
    /*JSONArray containers = new JSONArray();
        JSONObject container = new JSONObject();
		container.put("containerName", "mongodb");
		container.put("image", "nginx");
		containers.add(container);

		params.put("containers.n", containers.toJSONString());

		UnitResponse result = Xian.call("qcloudContainerService", "modifyClusterServiceImage", params);*/
    String outString = HttpKit.post("http://localhost:9125/v1.0/qcloudContainerService/modifyClusterServiceImage").addParams(params).execute();
    UnitResponse result = UnitResponse.create(JSON.parseObject(outString));
    System.out.println(result.getData().toString());
}
Also used : HashMap(java.util.HashMap) UnitResponse(info.xiancloud.core.message.UnitResponse) JSONObject(com.alibaba.fastjson.JSONObject)

Example 73 with UnitResponse

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

the class App method describeServiceEvent.

/**
 * 获取服务事件列表
 */
static void describeServiceEvent() {
    // 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", "describeServiceEvent", 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 74 with UnitResponse

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

the class DeployApplications_v_2 method execute.

@Override
public UnitResponse execute(UnitRequest msg) {
    String applications = msg.getString("applications");
    UnitResponse unitResponseObject;
    if (applications != null && applications.contains("=")) {
        unitResponseObject = UnitResponse.failure(null, NOT_SUPPORTED_TIP);
    } else
        unitResponseObject = deploy(msg);
    unitResponseObject.getContext().setPretty(true);
    return unitResponseObject;
}
Also used : UnitResponse(info.xiancloud.core.message.UnitResponse)

Example 75 with UnitResponse

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

the class CacheMapRemoveUnit method execute.

@Override
public UnitResponse execute(UnitRequest msg) {
    String key = msg.getArgMap().get("key").toString();
    String field = msg.getArgMap().get("field").toString();
    CacheConfigBean cacheConfigBean = msg.get("cacheConfig", CacheConfigBean.class);
    long length;
    try {
        length = Redis.call(cacheConfigBean, jedis -> jedis.hdel(key, field));
    } catch (Exception e) {
        return UnitResponse.exception(e);
    }
    return UnitResponse.success(length);
}
Also used : Group(info.xiancloud.core.Group) Unit(info.xiancloud.core.Unit) Input(info.xiancloud.core.Input) CacheConfigBean(info.xiancloud.core.support.cache.CacheConfigBean) Redis(info.xiancloud.cache.redis.Redis) UnitRequest(info.xiancloud.core.message.UnitRequest) CacheGroup(info.xiancloud.cache.service.CacheGroup) UnitResponse(info.xiancloud.core.message.UnitResponse) UnitMeta(info.xiancloud.core.UnitMeta) CacheConfigBean(info.xiancloud.core.support.cache.CacheConfigBean)

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