Search in sources :

Example 1 with LogException

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

the class AliyunLogDriver method listLogstore.

/**
 * 列出当前 project 下的所有日志库名称
 *
 * @param aliyun
 * @param project
 * @return
 */
public List<String> listLogstore(AliyunConfig.Aliyun aliyun, String project) {
    int offset = 0;
    String logStoreSubName = "";
    ListLogStoresRequest req = new ListLogStoresRequest(project, offset, QUERY_SIZE, logStoreSubName);
    try {
        Client client = buildClient(aliyun);
        return client.ListLogStores(req).GetLogStores();
    } catch (LogException lg) {
        log.error("阿里云日志服务查询LogStore错误! , {}", lg.GetErrorMessage());
    }
    return Collections.emptyList();
}
Also used : ListLogStoresRequest(com.aliyun.openservices.log.request.ListLogStoresRequest) Client(com.aliyun.openservices.log.Client) LogException(com.aliyun.openservices.log.exception.LogException)

Example 2 with LogException

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

the class AliyunLogDriver method listConfig.

public List<String> listConfig(AliyunConfig.Aliyun aliyun, String project, String logstore) {
    int offset = 0;
    ListConfigRequest req = new ListConfigRequest(project, offset, QUERY_SIZE);
    req.SetLogstoreName(logstore);
    try {
        Client client = buildClient(aliyun);
        return client.ListConfig(req).GetConfigs();
    } catch (LogException lg) {
        log.error("阿里云日志服务查询Config错误! , {}", lg.GetErrorMessage());
    }
    return Collections.emptyList();
}
Also used : ListConfigRequest(com.aliyun.openservices.log.request.ListConfigRequest) Client(com.aliyun.openservices.log.Client) LogException(com.aliyun.openservices.log.exception.LogException)

Example 3 with LogException

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

the class AliyunLogMachineGroupDriver method getMachineGroups.

public List<String> getMachineGroups(AliyunConfig.Aliyun aliyun, String project, String groupName) {
    int offset = 0;
    ListMachineGroupRequest req = new ListMachineGroupRequest(project, groupName, offset, QUERY_SIZE);
    List<String> machineGroups = new ArrayList<>();
    try {
        Client client = buildClient(aliyun);
        machineGroups = client.ListMachineGroup(req).GetMachineGroups();
    } catch (LogException lg) {
        log.error("阿里云日志服务查询MachineGroup错误! , {}", lg.GetErrorMessage());
    }
    return machineGroups;
}
Also used : ArrayList(java.util.ArrayList) Client(com.aliyun.openservices.log.Client) LogException(com.aliyun.openservices.log.exception.LogException)

Example 4 with LogException

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

the class AliyunLogDriver method listProject.

/**
 * 列出 project
 *
 * @param aliyun
 * @param project
 * @return
 */
public List<Project> listProject(AliyunConfig.Aliyun aliyun, String project) {
    int offset = 0;
    ListProjectRequest req = new ListProjectRequest(project, offset, QUERY_SIZE);
    try {
        Client client = buildClient(aliyun);
        return client.ListProject(req).getProjects();
    } catch (LogException lg) {
        log.error("阿里云日志服务查询Project错误! , {}", lg.GetErrorMessage());
    }
    return Collections.emptyList();
}
Also used : ListProjectRequest(com.aliyun.openservices.log.request.ListProjectRequest) Client(com.aliyun.openservices.log.Client) LogException(com.aliyun.openservices.log.exception.LogException)

Example 5 with LogException

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

the class AliyunLogMachineGroupDriver method createMachineGroup.

public void createMachineGroup(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);
        CreateMachineGroupRequest req = new CreateMachineGroupRequest(logMember.getLog().getProject(), machineGroup);
        client.CreateMachineGroup(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