1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. getAuditEvents
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

tencentcloud.getAuditEvents

Explore with Pulumi AI

tencentcloud logo
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

    Use this data source to query the events list supported by the audit.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const events = tencentcloud.getAuditEvents({
        endTime: 1727437441,
        isReturnLocation: 1,
        lookupAttributes: [
            {
                attributeKey: "ResourceType",
                attributeValue: "cvm",
            },
            {
                attributeKey: "OnlyRecordNotSeen",
                attributeValue: "0",
            },
            {
                attributeKey: "EventPlatform",
                attributeValue: "0",
            },
        ],
        maxResults: 50,
        startTime: 1727433841,
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    events = tencentcloud.get_audit_events(end_time=1727437441,
        is_return_location=1,
        lookup_attributes=[
            {
                "attribute_key": "ResourceType",
                "attribute_value": "cvm",
            },
            {
                "attribute_key": "OnlyRecordNotSeen",
                "attribute_value": "0",
            },
            {
                "attribute_key": "EventPlatform",
                "attribute_value": "0",
            },
        ],
        max_results=50,
        start_time=1727433841)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := tencentcloud.GetAuditEvents(ctx, &tencentcloud.GetAuditEventsArgs{
    			EndTime:          1727437441,
    			IsReturnLocation: pulumi.Float64Ref(1),
    			LookupAttributes: []tencentcloud.GetAuditEventsLookupAttribute{
    				{
    					AttributeKey:   "ResourceType",
    					AttributeValue: pulumi.StringRef("cvm"),
    				},
    				{
    					AttributeKey:   "OnlyRecordNotSeen",
    					AttributeValue: pulumi.StringRef("0"),
    				},
    				{
    					AttributeKey:   "EventPlatform",
    					AttributeValue: pulumi.StringRef("0"),
    				},
    			},
    			MaxResults: pulumi.Float64Ref(50),
    			StartTime:  1727433841,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var events = Tencentcloud.GetAuditEvents.Invoke(new()
        {
            EndTime = 1727437441,
            IsReturnLocation = 1,
            LookupAttributes = new[]
            {
                new Tencentcloud.Inputs.GetAuditEventsLookupAttributeInputArgs
                {
                    AttributeKey = "ResourceType",
                    AttributeValue = "cvm",
                },
                new Tencentcloud.Inputs.GetAuditEventsLookupAttributeInputArgs
                {
                    AttributeKey = "OnlyRecordNotSeen",
                    AttributeValue = "0",
                },
                new Tencentcloud.Inputs.GetAuditEventsLookupAttributeInputArgs
                {
                    AttributeKey = "EventPlatform",
                    AttributeValue = "0",
                },
            },
            MaxResults = 50,
            StartTime = 1727433841,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.TencentcloudFunctions;
    import com.pulumi.tencentcloud.inputs.GetAuditEventsArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var events = TencentcloudFunctions.getAuditEvents(GetAuditEventsArgs.builder()
                .endTime("1727437441")
                .isReturnLocation(1)
                .lookupAttributes(            
                    GetAuditEventsLookupAttributeArgs.builder()
                        .attributeKey("ResourceType")
                        .attributeValue("cvm")
                        .build(),
                    GetAuditEventsLookupAttributeArgs.builder()
                        .attributeKey("OnlyRecordNotSeen")
                        .attributeValue("0")
                        .build(),
                    GetAuditEventsLookupAttributeArgs.builder()
                        .attributeKey("EventPlatform")
                        .attributeValue("0")
                        .build())
                .maxResults(50)
                .startTime("1727433841")
                .build());
    
        }
    }
    
    variables:
      events:
        fn::invoke:
          function: tencentcloud:getAuditEvents
          arguments:
            endTime: '1727437441'
            isReturnLocation: 1
            lookupAttributes:
              - attributeKey: ResourceType
                attributeValue: cvm
              - attributeKey: OnlyRecordNotSeen
                attributeValue: '0'
              - attributeKey: EventPlatform
                attributeValue: '0'
            maxResults: 50
            startTime: '1727433841'
    

    Using getAuditEvents

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getAuditEvents(args: GetAuditEventsArgs, opts?: InvokeOptions): Promise<GetAuditEventsResult>
    function getAuditEventsOutput(args: GetAuditEventsOutputArgs, opts?: InvokeOptions): Output<GetAuditEventsResult>
    def get_audit_events(end_time: Optional[float] = None,
                         id: Optional[str] = None,
                         is_return_location: Optional[float] = None,
                         lookup_attributes: Optional[Sequence[GetAuditEventsLookupAttribute]] = None,
                         max_results: Optional[float] = None,
                         result_output_file: Optional[str] = None,
                         start_time: Optional[float] = None,
                         opts: Optional[InvokeOptions] = None) -> GetAuditEventsResult
    def get_audit_events_output(end_time: Optional[pulumi.Input[float]] = None,
                         id: Optional[pulumi.Input[str]] = None,
                         is_return_location: Optional[pulumi.Input[float]] = None,
                         lookup_attributes: Optional[pulumi.Input[Sequence[pulumi.Input[GetAuditEventsLookupAttributeArgs]]]] = None,
                         max_results: Optional[pulumi.Input[float]] = None,
                         result_output_file: Optional[pulumi.Input[str]] = None,
                         start_time: Optional[pulumi.Input[float]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetAuditEventsResult]
    func GetAuditEvents(ctx *Context, args *GetAuditEventsArgs, opts ...InvokeOption) (*GetAuditEventsResult, error)
    func GetAuditEventsOutput(ctx *Context, args *GetAuditEventsOutputArgs, opts ...InvokeOption) GetAuditEventsResultOutput

    > Note: This function is named GetAuditEvents in the Go SDK.

    public static class GetAuditEvents 
    {
        public static Task<GetAuditEventsResult> InvokeAsync(GetAuditEventsArgs args, InvokeOptions? opts = null)
        public static Output<GetAuditEventsResult> Invoke(GetAuditEventsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetAuditEventsResult> getAuditEvents(GetAuditEventsArgs args, InvokeOptions options)
    public static Output<GetAuditEventsResult> getAuditEvents(GetAuditEventsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: tencentcloud:index/getAuditEvents:getAuditEvents
      arguments:
        # arguments dictionary

    The following arguments are supported:

    EndTime double
    End timestamp in seconds (the time range for query is less than 30 days).
    StartTime double
    Start timestamp in seconds (cannot be 90 days after the current time).
    Id string
    IsReturnLocation double
    Whether to return the IP location. 1: yes, 0: no.
    LookupAttributes List<GetAuditEventsLookupAttribute>
    Search condition. Valid values: RequestId, EventName, ActionType (write/read), PrincipalId (sub-account), ResourceType, ResourceName, AccessKeyId, SensitiveAction, ApiErrorCode, CamErrorCode, and Tags (Format of AttributeValue: [{"key":"","value":""}]).
    MaxResults double
    Max number of returned logs (up to 50).
    ResultOutputFile string
    Used to save results.
    EndTime float64
    End timestamp in seconds (the time range for query is less than 30 days).
    StartTime float64
    Start timestamp in seconds (cannot be 90 days after the current time).
    Id string
    IsReturnLocation float64
    Whether to return the IP location. 1: yes, 0: no.
    LookupAttributes []GetAuditEventsLookupAttribute
    Search condition. Valid values: RequestId, EventName, ActionType (write/read), PrincipalId (sub-account), ResourceType, ResourceName, AccessKeyId, SensitiveAction, ApiErrorCode, CamErrorCode, and Tags (Format of AttributeValue: [{"key":"","value":""}]).
    MaxResults float64
    Max number of returned logs (up to 50).
    ResultOutputFile string
    Used to save results.
    endTime Double
    End timestamp in seconds (the time range for query is less than 30 days).
    startTime Double
    Start timestamp in seconds (cannot be 90 days after the current time).
    id String
    isReturnLocation Double
    Whether to return the IP location. 1: yes, 0: no.
    lookupAttributes List<GetAuditEventsLookupAttribute>
    Search condition. Valid values: RequestId, EventName, ActionType (write/read), PrincipalId (sub-account), ResourceType, ResourceName, AccessKeyId, SensitiveAction, ApiErrorCode, CamErrorCode, and Tags (Format of AttributeValue: [{"key":"","value":""}]).
    maxResults Double
    Max number of returned logs (up to 50).
    resultOutputFile String
    Used to save results.
    endTime number
    End timestamp in seconds (the time range for query is less than 30 days).
    startTime number
    Start timestamp in seconds (cannot be 90 days after the current time).
    id string
    isReturnLocation number
    Whether to return the IP location. 1: yes, 0: no.
    lookupAttributes GetAuditEventsLookupAttribute[]
    Search condition. Valid values: RequestId, EventName, ActionType (write/read), PrincipalId (sub-account), ResourceType, ResourceName, AccessKeyId, SensitiveAction, ApiErrorCode, CamErrorCode, and Tags (Format of AttributeValue: [{"key":"","value":""}]).
    maxResults number
    Max number of returned logs (up to 50).
    resultOutputFile string
    Used to save results.
    end_time float
    End timestamp in seconds (the time range for query is less than 30 days).
    start_time float
    Start timestamp in seconds (cannot be 90 days after the current time).
    id str
    is_return_location float
    Whether to return the IP location. 1: yes, 0: no.
    lookup_attributes Sequence[GetAuditEventsLookupAttribute]
    Search condition. Valid values: RequestId, EventName, ActionType (write/read), PrincipalId (sub-account), ResourceType, ResourceName, AccessKeyId, SensitiveAction, ApiErrorCode, CamErrorCode, and Tags (Format of AttributeValue: [{"key":"","value":""}]).
    max_results float
    Max number of returned logs (up to 50).
    result_output_file str
    Used to save results.
    endTime Number
    End timestamp in seconds (the time range for query is less than 30 days).
    startTime Number
    Start timestamp in seconds (cannot be 90 days after the current time).
    id String
    isReturnLocation Number
    Whether to return the IP location. 1: yes, 0: no.
    lookupAttributes List<Property Map>
    Search condition. Valid values: RequestId, EventName, ActionType (write/read), PrincipalId (sub-account), ResourceType, ResourceName, AccessKeyId, SensitiveAction, ApiErrorCode, CamErrorCode, and Tags (Format of AttributeValue: [{"key":"","value":""}]).
    maxResults Number
    Max number of returned logs (up to 50).
    resultOutputFile String
    Used to save results.

    getAuditEvents Result

    The following output properties are available:

    EndTime double
    Events List<GetAuditEventsEvent>
    Logset. Note: null may be returned for this field, indicating that no valid values can be obtained.
    Id string
    StartTime double
    IsReturnLocation double
    LookupAttributes List<GetAuditEventsLookupAttribute>
    MaxResults double
    ResultOutputFile string
    EndTime float64
    Events []GetAuditEventsEvent
    Logset. Note: null may be returned for this field, indicating that no valid values can be obtained.
    Id string
    StartTime float64
    IsReturnLocation float64
    LookupAttributes []GetAuditEventsLookupAttribute
    MaxResults float64
    ResultOutputFile string
    endTime Double
    events List<GetAuditEventsEvent>
    Logset. Note: null may be returned for this field, indicating that no valid values can be obtained.
    id String
    startTime Double
    isReturnLocation Double
    lookupAttributes List<GetAuditEventsLookupAttribute>
    maxResults Double
    resultOutputFile String
    endTime number
    events GetAuditEventsEvent[]
    Logset. Note: null may be returned for this field, indicating that no valid values can be obtained.
    id string
    startTime number
    isReturnLocation number
    lookupAttributes GetAuditEventsLookupAttribute[]
    maxResults number
    resultOutputFile string
    end_time float
    events Sequence[GetAuditEventsEvent]
    Logset. Note: null may be returned for this field, indicating that no valid values can be obtained.
    id str
    start_time float
    is_return_location float
    lookup_attributes Sequence[GetAuditEventsLookupAttribute]
    max_results float
    result_output_file str
    endTime Number
    events List<Property Map>
    Logset. Note: null may be returned for this field, indicating that no valid values can be obtained.
    id String
    startTime Number
    isReturnLocation Number
    lookupAttributes List<Property Map>
    maxResults Number
    resultOutputFile String

    Supporting Types

    GetAuditEventsEvent

    GetAuditEventsEventResource

    GetAuditEventsLookupAttribute

    AttributeKey string
    Valid values: RequestId, EventName, ReadOnly, Username, ResourceType, ResourceName, AccessKeyId, and EventId Note: null may be returned for this field, indicating that no valid values can be obtained.
    AttributeValue string
    Value of AttributeValue Note: null may be returned for this field, indicating that no valid values can be obtained.
    AttributeKey string
    Valid values: RequestId, EventName, ReadOnly, Username, ResourceType, ResourceName, AccessKeyId, and EventId Note: null may be returned for this field, indicating that no valid values can be obtained.
    AttributeValue string
    Value of AttributeValue Note: null may be returned for this field, indicating that no valid values can be obtained.
    attributeKey String
    Valid values: RequestId, EventName, ReadOnly, Username, ResourceType, ResourceName, AccessKeyId, and EventId Note: null may be returned for this field, indicating that no valid values can be obtained.
    attributeValue String
    Value of AttributeValue Note: null may be returned for this field, indicating that no valid values can be obtained.
    attributeKey string
    Valid values: RequestId, EventName, ReadOnly, Username, ResourceType, ResourceName, AccessKeyId, and EventId Note: null may be returned for this field, indicating that no valid values can be obtained.
    attributeValue string
    Value of AttributeValue Note: null may be returned for this field, indicating that no valid values can be obtained.
    attribute_key str
    Valid values: RequestId, EventName, ReadOnly, Username, ResourceType, ResourceName, AccessKeyId, and EventId Note: null may be returned for this field, indicating that no valid values can be obtained.
    attribute_value str
    Value of AttributeValue Note: null may be returned for this field, indicating that no valid values can be obtained.
    attributeKey String
    Valid values: RequestId, EventName, ReadOnly, Username, ResourceType, ResourceName, AccessKeyId, and EventId Note: null may be returned for this field, indicating that no valid values can be obtained.
    attributeValue String
    Value of AttributeValue Note: null may be returned for this field, indicating that no valid values can be obtained.

    Package Details

    Repository
    tencentcloud tencentcloudstack/terraform-provider-tencentcloud
    License
    Notes
    This Pulumi package is based on the tencentcloud Terraform Provider.
    tencentcloud logo
    tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack