更新时间:2024-11-12 GMT+08:00
分享

查询审计日志

功能介绍

查询审计日志信息

调用方法

请参见如何调用API

URI

GET /v1/{project_id}/leagues/{league_id}/audit-info

表1 路径参数

参数

是否必选

参数类型

描述

league_id

String

空间id,最大32位,字母和数字组成

project_id

String

项目id,最大32位,字母和数字组成

表2 Query参数

参数

是否必选

参数类型

描述

limit

Integer

每页记录数,取值0-100

offset

Integer

记录数偏移量

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

用户凭证

Content-Type

String

消息体的类型(格式)

响应参数

状态码: 200

表4 响应Body参数

参数

参数类型

描述

lists

Array of TicsLeagueAuditLog objects

实例集合

total

Long

总记录数

表5 TicsLeagueAuditLog

参数

参数类型

描述

create_user_domain_id

String

创建者账户id

create_user_project_id

String

创建者项目id

creator_alias_name

String

创建者别名

event_end_time

String

事件结束时间

event_info

String

事件信息

event_start_time

String

事件开始时间

event_status

String

事件状态。NEW新建,SUBMITING提交中,ACCEPTED已接收,DEPLOYING部署中,RUNNING运行中,SUCCEEDED成功,FAILED失败,TERMINATED中止,TERMINATING中止中,PENDING等待中

id

Long

日志记录id

league_id

String

空间id

sponsor_agent_name

String

作业发起节点名称

请求示例

查询审计日志信息

get /v1/{project_id}/leagues/{league_id}/audit-info?offset=0&limit=10

响应示例

状态码: 200

查询审计日志成功

{
  "total" : 1,
  "lists" : [ {
    "id" : 73423,
    "league_id" : "00a5b6c8ed214c45b7d2f52ca8eb8d86",
    "event_info" : "Partner [space_creator] execute [VFL] job [目录_样本对齐] id:[5dc4ab1bfd664e80ae52d71d8b46472a] , use dataset [{\"space_creator\":\"multidir_true1\",\"dayu002\":\"breast_hetero_mini_guest\"}], consume [10000] millis, [SUCCEEDED]",
    "event_status" : "SUCCEEDED",
    "event_start_time" : "2022-10-28T07:48:26.000+00:00",
    "event_end_time" : "2022-10-28T07:48:36.000+00:00",
    "create_user_project_id" : "098593b07680d2a32f62c004a482da10",
    "create_user_domain_id" : "098593b06a80d2a30f5fc004c28f6da0",
    "creator_alias_name" : "space_creator",
    "sponsor_agent_name" : "agent_4760"
  } ]
}

SDK代码示例

SDK代码示例如下。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.tics.v1.region.TicsRegion;
import com.huaweicloud.sdk.tics.v1.*;
import com.huaweicloud.sdk.tics.v1.model.*;


public class ListAuditInfoSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");
        String projectId = "{project_id}";

        ICredential auth = new BasicCredentials()
                .withProjectId(projectId)
                .withAk(ak)
                .withSk(sk);

        TicsClient client = TicsClient.newBuilder()
                .withCredential(auth)
                .withRegion(TicsRegion.valueOf("<YOUR REGION>"))
                .build();
        ListAuditInfoRequest request = new ListAuditInfoRequest();
        request.withLeagueId("{league_id}");
        try {
            ListAuditInfoResponse response = client.listAuditInfo(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdktics.v1.region.tics_region import TicsRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdktics.v1 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

    client = TicsClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(TicsRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListAuditInfoRequest()
        request.league_id = "{league_id}"
        response = client.list_audit_info(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    tics "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/tics/v1"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/tics/v1/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/tics/v1/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")
    projectId := "{project_id}"

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := tics.NewTicsClient(
        tics.TicsClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ListAuditInfoRequest{}
	request.LeagueId = "{league_id}"
	response, err := client.ListAuditInfo(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

查询审计日志成功

相关文档