Search in sources :

Example 6 with LogException

use of com.aliyun.openservices.log.exception.LogException in project opscloud4 by ixrjog.

the class AliyunLogMachineGroupDriver method applyConfigToMachineGroup.

/**
 * 将配置应用到机器组
 *
 * @param logMember
 * @return
 */
private void applyConfigToMachineGroup(AliyunConfig.Aliyun aliyun, AliyunLogMemberVO.LogMember logMember) {
    ApplyConfigToMachineGroupRequest req = new ApplyConfigToMachineGroupRequest(logMember.getLog().getProject(), logMember.getServerGroup().getName(), logMember.getLog().getConfig());
    try {
        Client client = buildClient(aliyun);
        client.ApplyConfigToMachineGroup(req);
    } catch (LogException lg) {
        lg.printStackTrace();
    }
}
Also used : Client(com.aliyun.openservices.log.Client) LogException(com.aliyun.openservices.log.exception.LogException)

Example 7 with LogException

use of com.aliyun.openservices.log.exception.LogException in project opscloud4 by ixrjog.

the class AliyunLogMachineGroupDriver method updateMachineGroup.

public void updateMachineGroup(AliyunConfig.Aliyun aliyun, AliyunLogMemberVO.LogMember logMember) {
    MachineGroup machineGroup = new MachineGroup(logMember.getServerGroupName(), MACHINE_IDENTIFY_TYPE, logMember.getMachineList());
    machineGroup.SetGroupTopic(StringUtils.isEmpty(logMember.getTopic()) ? logMember.getServerGroupName() : logMember.getTopic());
    try {
        Client client = buildClient(aliyun);
        UpdateMachineGroupRequest req = new UpdateMachineGroupRequest(logMember.getLog().getProject(), machineGroup);
        client.UpdateMachineGroup(req);
    } catch (LogException lg) {
        log.error("阿里云日志服务更新MachineGroup错误! , {}", lg.GetErrorMessage());
    }
}
Also used : MachineGroup(com.aliyun.openservices.log.common.MachineGroup) Client(com.aliyun.openservices.log.Client) LogException(com.aliyun.openservices.log.exception.LogException)

Aggregations

Client (com.aliyun.openservices.log.Client)7 LogException (com.aliyun.openservices.log.exception.LogException)7 MachineGroup (com.aliyun.openservices.log.common.MachineGroup)2 ListConfigRequest (com.aliyun.openservices.log.request.ListConfigRequest)1 ListLogStoresRequest (com.aliyun.openservices.log.request.ListLogStoresRequest)1 ListProjectRequest (com.aliyun.openservices.log.request.ListProjectRequest)1 ArrayList (java.util.ArrayList)1