11import { apiConnect } from '../modules/tunnel-api-connect/apiconnect.js' ;
22import { logger } from '../logger.js' ;
3- import { TeamDeviceCredentials } from '../types.js' ;
3+ import { EnrolledTeamDeviceCredentials } from '../types.js' ;
44import { GenericLog } from '../types/logs.js' ;
55
66export interface StartAuditLogsQueryParams {
@@ -22,7 +22,7 @@ export interface StartAuditLogsQueryOutput {
2222}
2323
2424export interface StartAuditLogsQueryRequest {
25- path : 'logs-teamdevice /StartAuditLogsQuery' ;
25+ path : 'cli /StartAuditLogsQuery' ;
2626 input : StartAuditLogsQueryParams ;
2727 output : StartAuditLogsQueryOutput ;
2828}
@@ -58,31 +58,29 @@ export interface GetAuditLogQueryResultsOutput {
5858}
5959
6060export interface GetAuditLogQueryResultsRequest {
61- path : 'logs-teamdevice /GetAuditLogQueryResults' ;
61+ path : 'cli /GetAuditLogQueryResults' ;
6262 input : GetAuditLogQueryResultsParams ;
6363 output : GetAuditLogQueryResultsOutput ;
6464}
65-
6665const MAX_RESULT = 1000 ;
6766
6867export const getAuditLogs = async ( params : {
6968 queryParams : StartAuditLogsQueryParams ;
70- teamDeviceCredentials : TeamDeviceCredentials ;
69+ enrolledTeamDeviceCredentials : EnrolledTeamDeviceCredentials ;
7170} ) : Promise < GenericLog [ ] > => {
72- const { teamDeviceCredentials , queryParams } = params ;
71+ const { enrolledTeamDeviceCredentials , queryParams } = params ;
7372
7473 const api = await apiConnect ( {
7574 useProductionCertificate : true ,
7675 } ) ;
7776
7877 const { queryExecutionId } = await api . sendSecureContent < StartAuditLogsQueryRequest > ( {
7978 ...api ,
80- path : 'logs-teamdevice /StartAuditLogsQuery' ,
79+ path : 'cli /StartAuditLogsQuery' ,
8180 payload : queryParams ,
8281 authentication : {
83- type : 'teamDevice' ,
84- teamDeviceKeys : teamDeviceCredentials ,
85- teamUuid : teamDeviceCredentials . uuid ,
82+ type : 'enrolledDevice' ,
83+ enrolledTeamDeviceKeys : enrolledTeamDeviceCredentials ,
8684 } ,
8785 } ) ;
8886
@@ -93,12 +91,11 @@ export const getAuditLogs = async (params: {
9391 await new Promise ( ( resolve ) => setTimeout ( resolve , 2000 ) ) ;
9492 result = await api . sendSecureContent < GetAuditLogQueryResultsRequest > ( {
9593 ...api ,
96- path : 'logs-teamdevice /GetAuditLogQueryResults' ,
94+ path : 'cli /GetAuditLogQueryResults' ,
9795 payload : { queryExecutionId, maxResults : MAX_RESULT , nextToken : result ?. nextToken } ,
9896 authentication : {
99- type : 'teamDevice' ,
100- teamDeviceKeys : teamDeviceCredentials ,
101- teamUuid : teamDeviceCredentials . uuid ,
97+ type : 'enrolledDevice' ,
98+ enrolledTeamDeviceKeys : enrolledTeamDeviceCredentials ,
10299 } ,
103100 } ) ;
104101 logger . debug ( `Query state: ${ result . state } ` ) ;
0 commit comments