Skip to content

Commit fdff247

Browse files
feat(api): api update
1 parent 21244bd commit fdff247

File tree

3 files changed

+226
-75
lines changed

3 files changed

+226
-75
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1742
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-babe0d060817f6b0b5be1c3cb585e4e56cae6202c4569b3e5681b856fa38a98a.yml
3-
openapi_spec_hash: 5799886c97f4447ddbfce4c6fccf3fe1
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-210311486e08edcaebbdb9f768581abcf93a533da2ba5a0dbdae8571a0dd47cd.yml
3+
openapi_spec_hash: 89af9166237af6fcdc5d0b138ab9e73a
44
config_hash: cb36b26a5fcc81fa60c65016b1e74f0a

src/resources/accounts/logs/audit.ts

Lines changed: 203 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -239,132 +239,283 @@ export interface AuditListParams extends CursorLimitPaginationParams {
239239
account_id: string;
240240

241241
/**
242-
* Query param: Filters actions based on a given timestamp in the format
243-
* yyyy-mm-dd, returning only logs that occurred on and before the specified date.
242+
* Query param: Limits the returned results to logs older than the specified date.
243+
* This can be a date string 2019-04-30 (interpreted in UTC) or an absolute
244+
* timestamp that conforms to RFC3339.
244245
*/
245246
before: string;
246247

247248
/**
248-
* Query param: Filters actions based on a given timestamp in the format
249-
* yyyy-mm-dd, returning only logs that occurred on and after the specified date.
249+
* Query param: Limits the returned results to logs newer than the specified date.
250+
* This can be a date string 2019-04-30 (interpreted in UTC) or an absolute
251+
* timestamp that conforms to RFC3339.
250252
*/
251253
since: string;
252254

253255
/**
254-
* Query param: Filters by the account name.
256+
* Query param:
255257
*/
256-
account_name?: string;
258+
account_name?: AuditListParams.AccountName;
257259

258260
/**
259-
* Query param: Whether the action was successful or not.
261+
* Query param:
260262
*/
261-
action_result?: 'success' | 'failure';
263+
action_result?: AuditListParams.ActionResult;
262264

263265
/**
264-
* Query param: Filters by the action type.
266+
* Query param:
265267
*/
266-
action_type?: 'create' | 'delete' | 'view' | 'update';
268+
action_type?: AuditListParams.ActionType;
267269

268270
/**
269-
* Query param: Filters by the actor context.
271+
* Query param:
270272
*/
271-
actor_context?: 'api_key' | 'api_token' | 'dash' | 'oauth' | 'origin_ca_key';
273+
actor_context?: AuditListParams.ActorContext;
272274

273275
/**
274-
* Query param: Filters by the actor's email address.
276+
* Query param:
275277
*/
276-
actor_email?: string;
278+
actor_email?: AuditListParams.ActorEmail;
277279

278280
/**
279-
* Query param: Filters by the actor ID. This can be either the Account ID or User
280-
* ID.
281+
* Query param:
281282
*/
282-
actor_id?: string;
283+
actor_id?: AuditListParams.ActorID;
283284

284285
/**
285-
* Query param: The IP address where the action was initiated.
286+
* Query param:
286287
*/
287-
actor_ip_address?: string;
288+
actor_ip_address?: AuditListParams.ActorIPAddress;
288289

289290
/**
290-
* Query param: Filters by the API token ID when the actor context is an api_token
291-
* or oauth.
291+
* Query param:
292292
*/
293-
actor_token_id?: string;
293+
actor_token_id?: AuditListParams.ActorTokenID;
294294

295295
/**
296-
* Query param: Filters by the API token name when the actor context is an
297-
* api_token or oauth.
296+
* Query param:
298297
*/
299-
actor_token_name?: string;
298+
actor_token_name?: AuditListParams.ActorTokenName;
300299

301300
/**
302-
* Query param: Filters by the actor type.
301+
* Query param:
303302
*/
304-
actor_type?: 'cloudflare_admin' | 'account' | 'user';
303+
actor_type?: AuditListParams.ActorType;
305304

306305
/**
307-
* Query param: Finds a specific log by its ID.
306+
* Query param:
308307
*/
309-
audit_log_id?: string;
308+
audit_log_id?: AuditListParams.AuditLogID;
310309

311310
/**
312311
* Query param: Sets sorting order.
313312
*/
314313
direction?: 'desc' | 'asc';
315314

316315
/**
317-
* Query param: Filters by the response CF Ray ID.
316+
* Query param:
318317
*/
319-
raw_cf_ray_id?: string;
318+
raw_cf_ray_id?: AuditListParams.RawCfRayID;
320319

321320
/**
322-
* Query param: The HTTP method for the API call.
321+
* Query param:
323322
*/
324-
raw_method?: string;
323+
raw_method?: AuditListParams.RawMethod;
325324

326325
/**
327-
* Query param: The response status code that was returned.
326+
* Query param:
328327
*/
329-
raw_status_code?: number;
328+
raw_status_code?: AuditListParams.RawStatusCode;
330329

331330
/**
332-
* Query param: Filters by the request URI.
331+
* Query param:
333332
*/
334-
raw_uri?: string;
333+
raw_uri?: AuditListParams.RawURI;
335334

336335
/**
337-
* Query param: Filters by the resource ID.
336+
* Query param:
338337
*/
339-
resource_id?: string;
338+
resource_id?: AuditListParams.ResourceID;
340339

341340
/**
342-
* Query param: Filters audit logs by the Cloudflare product associated with the
343-
* changed resource.
341+
* Query param:
344342
*/
345-
resource_product?: string;
343+
resource_product?: AuditListParams.ResourceProduct;
346344

347345
/**
348-
* Query param: Filters by the resource scope, specifying whether the resource is
349-
* associated with an user, an account, or a zone.
346+
* Query param:
350347
*/
351-
resource_scope?: 'accounts' | 'user' | 'zones';
348+
resource_scope?: AuditListParams.ResourceScope;
352349

353350
/**
354-
* Query param: Filters audit logs based on the unique type of resource changed by
355-
* the action.
351+
* Query param:
356352
*/
357-
resource_type?: string;
353+
resource_type?: AuditListParams.ResourceType;
358354

359355
/**
360-
* Query param: Filters by the zone ID.
356+
* Query param:
361357
*/
362-
zone_id?: string;
358+
zone_id?: AuditListParams.ZoneID;
363359

364360
/**
365-
* Query param: Filters by the zone name associated with the change.
361+
* Query param:
366362
*/
367-
zone_name?: string;
363+
zone_name?: AuditListParams.ZoneName;
364+
}
365+
366+
export namespace AuditListParams {
367+
export interface AccountName {
368+
/**
369+
* Filters out audit logs by the account name.
370+
*/
371+
not?: Array<string>;
372+
}
373+
374+
export interface ActionResult {
375+
/**
376+
* Filters out audit logs by whether the action was successful or not.
377+
*/
378+
not?: Array<'success' | 'failure'>;
379+
}
380+
381+
export interface ActionType {
382+
/**
383+
* Filters out audit logs by the action type.
384+
*/
385+
not?: Array<'create' | 'delete' | 'view' | 'update'>;
386+
}
387+
388+
export interface ActorContext {
389+
/**
390+
* Filters out audit logs by the actor context.
391+
*/
392+
not?: Array<'api_key' | 'api_token' | 'dash' | 'oauth' | 'origin_ca_key'>;
393+
}
394+
395+
export interface ActorEmail {
396+
/**
397+
* Filters out audit logs by the actor's email address.
398+
*/
399+
not?: Array<string>;
400+
}
401+
402+
export interface ActorID {
403+
/**
404+
* Filters out audit logs by the actor ID. This can be either the Account ID or
405+
* User ID.
406+
*/
407+
not?: Array<string>;
408+
}
409+
410+
export interface ActorIPAddress {
411+
/**
412+
* Filters out audit logs IP address where the action was initiated.
413+
*/
414+
not?: Array<string>;
415+
}
416+
417+
export interface ActorTokenID {
418+
/**
419+
* Filters out audit logs by the API token ID when the actor context is an
420+
* api_token or oauth.
421+
*/
422+
not?: Array<string>;
423+
}
424+
425+
export interface ActorTokenName {
426+
/**
427+
* Filters out audit logs by the API token name when the actor context is an
428+
* api_token or oauth.
429+
*/
430+
not?: Array<string>;
431+
}
432+
433+
export interface ActorType {
434+
/**
435+
* Filters out audit logs by the actor type.
436+
*/
437+
not?: Array<'cloudflare_admin' | 'account' | 'user'>;
438+
}
439+
440+
export interface AuditLogID {
441+
/**
442+
* Filters out audit logs by their IDs.
443+
*/
444+
not?: Array<string>;
445+
}
446+
447+
export interface RawCfRayID {
448+
/**
449+
* Filters out audit logs by the response CF Ray ID.
450+
*/
451+
not?: Array<string>;
452+
}
453+
454+
export interface RawMethod {
455+
/**
456+
* Filters out audit logs by the HTTP method for the API call.
457+
*/
458+
not?: Array<string>;
459+
}
460+
461+
export interface RawStatusCode {
462+
/**
463+
* Filters out audit logs by the response status code that was returned.
464+
*/
465+
not?: Array<number>;
466+
}
467+
468+
export interface RawURI {
469+
/**
470+
* Filters out audit logs by the request URI.
471+
*/
472+
not?: Array<string>;
473+
}
474+
475+
export interface ResourceID {
476+
/**
477+
* Filters out audit logs by the resource ID.
478+
*/
479+
not?: Array<string>;
480+
}
481+
482+
export interface ResourceProduct {
483+
/**
484+
* Filters out audit logs by the Cloudflare product associated with the changed
485+
* resource.
486+
*/
487+
not?: Array<string>;
488+
}
489+
490+
export interface ResourceScope {
491+
/**
492+
* Filters out audit logs by the resource scope, specifying whether the resource is
493+
* associated with an user, an account, or a zone.
494+
*/
495+
not?: Array<'accounts' | 'user' | 'zones'>;
496+
}
497+
498+
export interface ResourceType {
499+
/**
500+
* Filters out audit logs based on the unique type of resource changed by the
501+
* action.
502+
*/
503+
not?: Array<string>;
504+
}
505+
506+
export interface ZoneID {
507+
/**
508+
* Filters out audit logs by the zone ID.
509+
*/
510+
not?: Array<string>;
511+
}
512+
513+
export interface ZoneName {
514+
/**
515+
* Filters out audit logs by the zone name associated with the change.
516+
*/
517+
not?: Array<string>;
518+
}
368519
}
369520

370521
Audit.AuditListResponsesCursorLimitPagination = AuditListResponsesCursorLimitPagination;

tests/api-resources/accounts/logs/audit.test.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,30 @@ describe('resource audit', () => {
3232
account_id: 'a67e14daa5f8dceeb91fe5449ba496ef',
3333
before: '2024-10-31',
3434
since: '2024-10-30',
35-
account_name: 'account_name',
36-
action_result: 'success',
37-
action_type: 'create',
38-
actor_context: 'api_key',
39-
actor_email: 'alice@example.com',
40-
actor_id: '1d20c3afe174f18b642710cec6298a9d',
41-
actor_ip_address: '17.168.228.63',
42-
actor_token_id: '144cdb2e39c55e203cf225d8d8208647',
43-
actor_token_name: 'Test Token',
44-
actor_type: 'account',
45-
audit_log_id: 'f174be97-19b1-40d6-954d-70cd5fbd52db',
35+
account_name: { not: ['string'] },
36+
action_result: { not: ['success'] },
37+
action_type: { not: ['create'] },
38+
actor_context: { not: ['api_key'] },
39+
actor_email: { not: ['alice@example.com'] },
40+
actor_id: { not: ['1d20c3afe174f18b642710cec6298a9d'] },
41+
actor_ip_address: { not: ['17.168.228.63'] },
42+
actor_token_id: { not: ['144cdb2e39c55e203cf225d8d8208647'] },
43+
actor_token_name: { not: ['Test Token'] },
44+
actor_type: { not: ['account'] },
45+
audit_log_id: { not: ['f174be97-19b1-40d6-954d-70cd5fbd52db'] },
4646
cursor: 'Q1buH-__DQqqig7SVYXT-SsMOTGY2Z3Y80W-fGgva7yaDdmPKveucH5ddOcHsJRhNb-xUK8agZQqkJSMAENGO8NU6g==',
4747
direction: 'desc',
4848
limit: 25,
49-
raw_cf_ray_id: '8e8dd2156ef28414',
50-
raw_method: 'GET',
51-
raw_status_code: 200,
52-
raw_uri: 'raw_uri',
53-
resource_id: 'resource_id',
54-
resource_product: 'Stream',
55-
resource_scope: 'accounts',
56-
resource_type: 'Video',
57-
zone_id: 'zone_id',
58-
zone_name: 'example.com',
49+
raw_cf_ray_id: { not: ['8e8dd2156ef28414'] },
50+
raw_method: { not: ['GET'] },
51+
raw_status_code: { not: [200] },
52+
raw_uri: { not: ['string'] },
53+
resource_id: { not: ['string'] },
54+
resource_product: { not: ['Stream'] },
55+
resource_scope: { not: ['accounts'] },
56+
resource_type: { not: ['Video'] },
57+
zone_id: { not: ['string'] },
58+
zone_name: { not: ['example.com'] },
5959
});
6060
});
6161
});

0 commit comments

Comments
 (0)