Skip to content

Commit

Permalink
Improves Timeline API docs content (elastic#192744)
Browse files Browse the repository at this point in the history
## Summary

Resolves elastic/security-docs-internal#35 by
improving the Timeline API docs content. Adds missing and improves
existing operation summaries and operation descriptions to adhere to our
[OAS
standards](https://elasticco.atlassian.net/wiki/spaces/DOC/pages/450494532/API+reference+docs).

---------

Co-authored-by: Jatin Kathuria <jtn.kathuria@gmail.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 19, 2024
1 parent f47987f commit 9765f73
Show file tree
Hide file tree
Showing 21 changed files with 320 additions and 204 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,9 @@ after 30 days. It also deletes other artifacts specific to the migration impleme
.catch(catchAxiosErrorFormatAndThrow);
}
/**
* Retrieves a clean draft timeline. If a draft timeline does not exist, it is created and returned.
* Create a clean draft Timeline or Timeline template for the current user.
> info
> If the user already has a draft Timeline, the existing draft Timeline is cleared and returned.
*/
async cleanDraftTimelines(props: CleanDraftTimelinesProps) {
Expand Down Expand Up @@ -589,6 +591,9 @@ Migrations are initiated per index. While the process is neither destructive nor
})
.catch(catchAxiosErrorFormatAndThrow);
}
/**
* Create a new Timeline or Timeline template.
*/
async createTimelines(props: CreateTimelinesProps) {
this.log.info(`${new Date().toISOString()} Calling API CreateTimelines`);
return this.kbnClient
Expand Down Expand Up @@ -661,6 +666,9 @@ Migrations are initiated per index. While the process is neither destructive nor
})
.catch(catchAxiosErrorFormatAndThrow);
}
/**
* Delete a note from a Timeline using the note ID.
*/
async deleteNote(props: DeleteNoteProps) {
this.log.info(`${new Date().toISOString()} Calling API DeleteNote`);
return this.kbnClient
Expand Down Expand Up @@ -691,6 +699,9 @@ Migrations are initiated per index. While the process is neither destructive nor
})
.catch(catchAxiosErrorFormatAndThrow);
}
/**
* Delete one or more Timelines or Timeline templates.
*/
async deleteTimelines(props: DeleteTimelinesProps) {
this.log.info(`${new Date().toISOString()} Calling API DeleteTimelines`);
return this.kbnClient
Expand Down Expand Up @@ -1045,6 +1056,9 @@ Migrations are initiated per index. While the process is neither destructive nor
})
.catch(catchAxiosErrorFormatAndThrow);
}
/**
* Export Timelines as an NDJSON file.
*/
async exportTimelines(props: ExportTimelinesProps) {
this.log.info(`${new Date().toISOString()} Calling API ExportTimelines`);
return this.kbnClient
Expand Down Expand Up @@ -1155,6 +1169,9 @@ finalize it.
})
.catch(catchAxiosErrorFormatAndThrow);
}
/**
* Get the details of the draft Timeline or Timeline template for the current user. If the user doesn't have a draft Timeline, an empty Timeline is returned.
*/
async getDraftTimelines(props: GetDraftTimelinesProps) {
this.log.info(`${new Date().toISOString()} Calling API GetDraftTimelines`);
return this.kbnClient
Expand Down Expand Up @@ -1221,7 +1238,7 @@ finalize it.
.catch(catchAxiosErrorFormatAndThrow);
}
/**
* Gets notes
* Get all notes for a given document.
*/
async getNotes(props: GetNotesProps) {
this.log.info(`${new Date().toISOString()} Calling API GetNotes`);
Expand Down Expand Up @@ -1315,6 +1332,9 @@ finalize it.
})
.catch(catchAxiosErrorFormatAndThrow);
}
/**
* Get the details of an existing saved Timeline or Timeline template.
*/
async getTimeline(props: GetTimelineProps) {
this.log.info(`${new Date().toISOString()} Calling API GetTimeline`);
return this.kbnClient
Expand All @@ -1329,6 +1349,9 @@ finalize it.
})
.catch(catchAxiosErrorFormatAndThrow);
}
/**
* Get a list of all saved Timelines or Timeline templates.
*/
async getTimelines(props: GetTimelinesProps) {
this.log.info(`${new Date().toISOString()} Calling API GetTimelines`);
return this.kbnClient
Expand Down Expand Up @@ -1363,6 +1386,9 @@ finalize it.
})
.catch(catchAxiosErrorFormatAndThrow);
}
/**
* Import Timelines.
*/
async importTimelines(props: ImportTimelinesProps) {
this.log.info(`${new Date().toISOString()} Calling API ImportTimelines`);
return this.kbnClient
Expand Down Expand Up @@ -1419,6 +1445,9 @@ finalize it.
})
.catch(catchAxiosErrorFormatAndThrow);
}
/**
* Install or update prepackaged Timelines.
*/
async installPrepackedTimelines(props: InstallPrepackedTimelinesProps) {
this.log.info(`${new Date().toISOString()} Calling API InstallPrepackedTimelines`);
return this.kbnClient
Expand Down Expand Up @@ -1474,7 +1503,7 @@ finalize it.
.catch(catchAxiosErrorFormatAndThrow);
}
/**
* Updates an existing timeline. This API is used to update the title, description, date range, pinned events, pinned queries, and/or pinned saved queries of an existing timeline.
* Update an existing Timeline. You can update the title, description, date range, pinned events, pinned queries, and/or pinned saved queries of an existing Timeline.
*/
async patchTimeline(props: PatchTimelineProps) {
this.log.info(`${new Date().toISOString()} Calling API PatchTimeline`);
Expand Down Expand Up @@ -1506,6 +1535,9 @@ finalize it.
})
.catch(catchAxiosErrorFormatAndThrow);
}
/**
* Favorite a Timeline or Timeline template for the current user.
*/
async persistFavoriteRoute(props: PersistFavoriteRouteProps) {
this.log.info(`${new Date().toISOString()} Calling API PersistFavoriteRoute`);
return this.kbnClient
Expand All @@ -1519,6 +1551,9 @@ finalize it.
})
.catch(catchAxiosErrorFormatAndThrow);
}
/**
* Add a note to a Timeline or update an existing note.
*/
async persistNoteRoute(props: PersistNoteRouteProps) {
this.log.info(`${new Date().toISOString()} Calling API PersistNoteRoute`);
return this.kbnClient
Expand All @@ -1532,6 +1567,9 @@ finalize it.
})
.catch(catchAxiosErrorFormatAndThrow);
}
/**
* Pin an event to an existing Timeline.
*/
async persistPinnedEventRoute(props: PersistPinnedEventRouteProps) {
this.log.info(`${new Date().toISOString()} Calling API PersistPinnedEventRoute`);
return this.kbnClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ paths:
x-labels: [serverless, ess]
x-codegen-enabled: true
operationId: CleanDraftTimelines
summary: Retrieves a draft timeline or timeline template.
summary: Create a clean draft Timeline or Timeline template
description: |
Retrieves a clean draft timeline. If a draft timeline does not exist, it is created and returned.
Create a clean draft Timeline or Timeline template for the current user.
> info
> If the user already has a draft Timeline, the existing draft Timeline is cleared and returned.
tags:
- access:securitySolution
requestBody:
description: The type of timeline to create. Valid values are `default` and `template`.
description: The type of Timeline to create. Valid values are `default` and `template`.
required: true
content:
application/json:
Expand All @@ -33,7 +35,7 @@ paths:
$ref: '../model/components.schema.yaml#/components/schemas/TimelineType'
responses:
'200':
description: Indicates that the draft timeline was successfully created. In the event the user already has a draft timeline, the existing draft timeline is cleared and returned.
description: Indicates that the draft Timeline was successfully created. In the event the user already has a draft Timeline, the existing draft Timeline is cleared and returned.
content:
application/json:
schema:
Expand All @@ -51,7 +53,7 @@ paths:
timeline:
$ref: '../model/components.schema.yaml#/components/schemas/TimelineResponse'
'403':
description: Indicates that the user does not have the required permissions to create a draft timeline.
description: Indicates that the user does not have the required permissions to create a draft Timeline.
content:
application:json:
schema:
Expand All @@ -62,7 +64,7 @@ paths:
status_code:
type: number
'409':
description: Indicates that there is already a draft timeline with the given timelineId.
description: Indicates that there is already a draft Timeline with the given `timelineId`.
content:
application:json:
schema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ paths:
x-labels: [serverless, ess]
x-codegen-enabled: true
operationId: CreateTimelines
summary: Creates a new timeline.
summary: Create a Timeline or Timeline template
description: Create a new Timeline or Timeline template.
tags:
- access:securitySolution
requestBody:
description: The required timeline fields used to create a new timeline along with optional fields that will be created if not provided.
description: The required Timeline fields used to create a new Timeline, along with optional fields that will be created if not provided.
required: true
content:
application/json:
Expand Down Expand Up @@ -53,7 +54,7 @@ paths:
$ref: '../model/components.schema.yaml#/components/schemas/SavedTimeline'
responses:
'200':
description: Indicates the timeline was successfully created.
description: Indicates the Timeline was successfully created.
content:
application/json:
schema:
Expand All @@ -70,7 +71,7 @@ paths:
timeline:
$ref: '../model/components.schema.yaml#/components/schemas/TimelineResponse'
'405':
description: Indicates that there was an error in the timeline creation.
description: Indicates that there was an error in the Timeline creation.
content:
application/json:
schema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ paths:
x-labels: [serverless, ess]
x-codegen-enabled: true
operationId: DeleteNote
summary: Deletes a note from a timeline.
summary: Delete a note
description: Delete a note from a Timeline using the note ID.
tags:
- access:securitySolution
requestBody:
description: The id of the note to delete.
description: The ID of the note to delete.
required: true
content:
application/json:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ paths:
x-labels: [serverless, ess]
x-codegen-enabled: true
operationId: DeleteTimelines
summary: Deletes one or more timelines or timeline templates.
summary: Delete Timelines or Timeline templates
description: Delete one or more Timelines or Timeline templates.
tags:
- access:securitySolution
requestBody:
description: The ids of the timelines or timeline templates to delete.
description: The IDs of the Timelines or Timeline templates to delete.
required: true
content:
application/json:
Expand All @@ -41,7 +42,7 @@ paths:
type: string
responses:
'200':
description: Indicates the timeline was successfully deleted.
description: Indicates the Timeline was successfully deleted.
content:
application/json:
schema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ paths:
x-labels: [serverless, ess]
x-codegen-enabled: true
operationId: ExportTimelines
summary: Exports timelines as an NDJSON file
summary: Export Timelines
description: Export Timelines as an NDJSON file.
tags:
- access:securitySolution
parameters:
Expand All @@ -29,7 +30,7 @@ paths:
type: string
description: The name of the file to export
requestBody:
description: The ids of the timelines to export
description: The IDs of the Timelines to export.
required: true
content:
application/json:
Expand All @@ -43,14 +44,14 @@ paths:
type: string
responses:
'200':
description: Indicates the timelines were successfully exported
description: Indicates the Timelines were successfully exported.
content:
application/ndjson:
schema:
type: string
description: NDJSON of the exported timelines
description: NDJSON of the exported Timelines
'400':
description: Indicates that the export size limit was exceeded
description: Indicates that the export size limit was exceeded.
content:
application/ndjson:
schema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ paths:
x-labels: [serverless, ess]
x-codegen-enabled: true
operationId: GetDraftTimelines
summary: Retrieves the draft timeline for the current user. If the user does not have a draft timeline, an empty timeline is returned.
summary: Get draft Timeline or Timeline template details
description: Get the details of the draft Timeline or Timeline template for the current user. If the user doesn't have a draft Timeline, an empty Timeline is returned.
tags:
- access:securitySolution
parameters:
Expand All @@ -26,7 +27,7 @@ paths:
$ref: '../model/components.schema.yaml#/components/schemas/TimelineType'
responses:
'200':
description: Indicates that the draft timeline was successfully retrieved.
description: Indicates that the draft Timeline was successfully retrieved.
content:
application/json:
schema:
Expand All @@ -44,7 +45,7 @@ paths:
timeline:
$ref: '../model/components.schema.yaml#/components/schemas/TimelineResponse'
'403':
description: If a draft timeline was not found and we attempted to create one, it indicates that the user does not have the required permissions to create a draft timeline.
description: If a draft Timeline was not found and we attempted to create one, it indicates that the user does not have the required permissions to create a draft Timeline.
content:
application:json:
schema:
Expand All @@ -55,7 +56,7 @@ paths:
status_code:
type: number
'409':
description: This should never happen, but if a draft timeline was not found and we attempted to create one, it indicates that there is already a draft timeline with the given timelineId.
description: This should never happen, but if a draft Timeline was not found and we attempted to create one, it indicates that there is already a draft Timeline with the given `timelineId`.
content:
application:json:
schema:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ paths:
x-labels: [serverless, ess]
x-codegen-enabled: true
operationId: GetNotes
description: Gets notes
summary: Get all notes for a given document.
description: Get all notes for a given document.
summary: Get notes
tags:
- access:securitySolution
parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const GetTimelineRequestQuery = z.object({
*/
template_timeline_id: z.string().optional(),
/**
* The ID of the timeline to retrieve
* The ID of the Timeline to retrieve.
*/
id: z.string().optional(),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ paths:
x-labels: [serverless, ess]
x-codegen-enabled: true
operationId: GetTimeline
summary: Get an existing saved timeline or timeline template. This API is used to retrieve an existing saved timeline or timeline template.
summary: Get Timeline or Timeline template details
description: Get the details of an existing saved Timeline or Timeline template.
tags:
- access:securitySolution
parameters:
Expand All @@ -31,10 +32,10 @@ paths:
name: id
schema:
type: string
description: The ID of the timeline to retrieve
description: The ID of the Timeline to retrieve.
responses:
'200':
description: Indicates that the (template) timeline was found and returned.
description: Indicates that the (template) Timeline was found and returned.
content:
application/json:
schema:
Expand Down
Loading

0 comments on commit 9765f73

Please sign in to comment.