From 15ac6bcc6b942193a935d71b362714a62011ac4f Mon Sep 17 00:00:00 2001 From: "elastic-renovate-prod[bot]" <174716857+elastic-renovate-prod[bot]@users.noreply.github.com> Date: Mon, 8 Dec 2025 03:17:01 +0000 Subject: [PATCH 1/2] chore(deps): update kibana-openapi-spec digest to bd3d07c --- generated/kbapi/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generated/kbapi/Makefile b/generated/kbapi/Makefile index dbe0f5801..8d0664be9 100644 --- a/generated/kbapi/Makefile +++ b/generated/kbapi/Makefile @@ -2,7 +2,7 @@ SHELL := /bin/bash ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) -github_ref ?= 38106c26e880d5ff0faf3a27c5582da5b83b9949 +github_ref ?= bd3d07c7bbbecc21b48a2cb7e02a2ca0dce2acac oas_url := https://raw.githubusercontent.com/elastic/kibana/$(github_ref)/oas_docs/output/kibana.yaml .PHONY: all From 6bed88448e4581d2b58024e52fe142fb5d3a8e0d Mon Sep 17 00:00:00 2001 From: Toby Brain Date: Mon, 8 Dec 2025 14:50:04 +1100 Subject: [PATCH 2/2] Fix Security API page size --- generated/kbapi/kibana.gen.go | 310 +++++++++++++++++++++++++++- generated/kbapi/transform_schema.go | 6 + 2 files changed, 306 insertions(+), 10 deletions(-) diff --git a/generated/kbapi/kibana.gen.go b/generated/kbapi/kibana.gen.go index 1c9d154a1..2431e6b4c 100644 --- a/generated/kbapi/kibana.gen.go +++ b/generated/kbapi/kibana.gen.go @@ -1427,6 +1427,15 @@ const ( SecurityEndpointManagementAPIAgentTypesSentinelOne SecurityEndpointManagementAPIAgentTypes = "sentinel_one" ) +// Defines values for SecurityEndpointManagementAPIApiSortField. +const ( + SecurityEndpointManagementAPIApiSortFieldCreatedAt SecurityEndpointManagementAPIApiSortField = "createdAt" + SecurityEndpointManagementAPIApiSortFieldCreatedBy SecurityEndpointManagementAPIApiSortField = "createdBy" + SecurityEndpointManagementAPIApiSortFieldName SecurityEndpointManagementAPIApiSortField = "name" + SecurityEndpointManagementAPIApiSortFieldUpdatedAt SecurityEndpointManagementAPIApiSortField = "updatedAt" + SecurityEndpointManagementAPIApiSortFieldUpdatedBy SecurityEndpointManagementAPIApiSortField = "updatedBy" +) + // Defines values for SecurityEndpointManagementAPICommand. const ( SecurityEndpointManagementAPICommandCancel SecurityEndpointManagementAPICommand = "cancel" @@ -1442,6 +1451,13 @@ const ( SecurityEndpointManagementAPICommandUpload SecurityEndpointManagementAPICommand = "upload" ) +// Defines values for SecurityEndpointManagementAPIEndpointScriptPlatform. +const ( + SecurityEndpointManagementAPIEndpointScriptPlatformLinux SecurityEndpointManagementAPIEndpointScriptPlatform = "linux" + SecurityEndpointManagementAPIEndpointScriptPlatformMacos SecurityEndpointManagementAPIEndpointScriptPlatform = "macos" + SecurityEndpointManagementAPIEndpointScriptPlatformWindows SecurityEndpointManagementAPIEndpointScriptPlatform = "windows" +) + // Defines values for SecurityEndpointManagementAPIResponseActionDetailsOutputsType. const ( SecurityEndpointManagementAPIResponseActionDetailsOutputsTypeJson SecurityEndpointManagementAPIResponseActionDetailsOutputsType = "json" @@ -1620,9 +1636,9 @@ const ( // Defines values for SecurityExceptionsAPIExceptionListOsType. const ( - SecurityExceptionsAPIExceptionListOsTypeLinux SecurityExceptionsAPIExceptionListOsType = "linux" - SecurityExceptionsAPIExceptionListOsTypeMacos SecurityExceptionsAPIExceptionListOsType = "macos" - SecurityExceptionsAPIExceptionListOsTypeWindows SecurityExceptionsAPIExceptionListOsType = "windows" + Linux SecurityExceptionsAPIExceptionListOsType = "linux" + Macos SecurityExceptionsAPIExceptionListOsType = "macos" + Windows SecurityExceptionsAPIExceptionListOsType = "windows" ) // Defines values for SecurityExceptionsAPIExceptionListType. @@ -3717,9 +3733,9 @@ const ( // Defines values for ConfigureRiskEngineSavedObjectJSONBodyFiltersEntityTypes. const ( - ConfigureRiskEngineSavedObjectJSONBodyFiltersEntityTypesHost ConfigureRiskEngineSavedObjectJSONBodyFiltersEntityTypes = "host" - ConfigureRiskEngineSavedObjectJSONBodyFiltersEntityTypesService ConfigureRiskEngineSavedObjectJSONBodyFiltersEntityTypes = "service" - ConfigureRiskEngineSavedObjectJSONBodyFiltersEntityTypesUser ConfigureRiskEngineSavedObjectJSONBodyFiltersEntityTypes = "user" + Host ConfigureRiskEngineSavedObjectJSONBodyFiltersEntityTypes = "host" + Service ConfigureRiskEngineSavedObjectJSONBodyFiltersEntityTypes = "service" + User ConfigureRiskEngineSavedObjectJSONBodyFiltersEntityTypes = "user" ) // Defines values for PostSecurityRoleQueryJSONBodySortDirection. @@ -17686,6 +17702,12 @@ type SecurityEndpointManagementAPIAgentIds1 = string // SecurityEndpointManagementAPIAgentTypes List of agent types to retrieve. Defaults to `endpoint`. type SecurityEndpointManagementAPIAgentTypes string +// SecurityEndpointManagementAPIApiPageSize Number of items per page +type SecurityEndpointManagementAPIApiPageSize = SecurityEndpointManagementAPIPageSize + +// SecurityEndpointManagementAPIApiSortField Determines which field is used to sort the results. +type SecurityEndpointManagementAPIApiSortField string + // SecurityEndpointManagementAPICancel defines model for Security_Endpoint_Management_API_Cancel. type SecurityEndpointManagementAPICancel struct { // AgentState The state of the response action for each agent ID that it was sent to @@ -17807,6 +17829,34 @@ type SecurityEndpointManagementAPIEndpointIds = []string // SecurityEndpointManagementAPIEndpointMetadataResponse defines model for Security_Endpoint_Management_API_EndpointMetadataResponse. type SecurityEndpointManagementAPIEndpointMetadataResponse = map[string]interface{} +// SecurityEndpointManagementAPIEndpointScript defines model for Security_Endpoint_Management_API_EndpointScript. +type SecurityEndpointManagementAPIEndpointScript struct { + CreatedAt *time.Time `json:"createdAt,omitempty"` + CreatedBy *string `json:"createdBy,omitempty"` + + // Description Description of the script and its purpose/functionality + Description *string `json:"description,omitempty"` + + // DownloadUri URI to download the script file. Note that this is the relative path and does not include the space (if applicable) + DownloadUri *string `json:"downloadUri,omitempty"` + Id *openapi_types.UUID `json:"id,omitempty"` + + // Instructions Instructions for using the script, including details around its supported input arguments + Instructions *string `json:"instructions,omitempty"` + Name *string `json:"name,omitempty"` + + // PathToExecutable The relative path to the file included in the archive that should be executed once its contents are extracted. Applicable only for scripts uploaded as an archive (.zip file for example). + PathToExecutable *string `json:"pathToExecutable,omitempty"` + Platform *[]SecurityEndpointManagementAPIEndpointScriptPlatform `json:"platform,omitempty"` + RequiresInput *bool `json:"requiresInput,omitempty"` + UpdatedAt *time.Time `json:"updatedAt,omitempty"` + UpdatedBy *string `json:"updatedBy,omitempty"` + Version *string `json:"version,omitempty"` +} + +// SecurityEndpointManagementAPIEndpointScriptPlatform defines model for Security_Endpoint_Management_API_EndpointScriptPlatform. +type SecurityEndpointManagementAPIEndpointScriptPlatform string + // SecurityEndpointManagementAPIExecute defines model for Security_Endpoint_Management_API_Execute. type SecurityEndpointManagementAPIExecute struct { // AgentState The state of the response action for each agent ID that it was sent to @@ -30141,6 +30191,24 @@ type CreateUpdateProtectionUpdatesNoteJSONBody struct { Note *string `json:"note,omitempty"` } +// EndpointScriptLibraryListScriptsParams defines parameters for EndpointScriptLibraryListScripts. +type EndpointScriptLibraryListScriptsParams struct { + // Page Page number of the results to return. Defaults to 1. + Page *SecurityEndpointManagementAPIPage `form:"page,omitempty" json:"page,omitempty"` + + // PageSize Number of results to return per page. Defaults to 10. Max value is 1000. + PageSize *SecurityEndpointManagementAPIApiPageSize `form:"pageSize,omitempty" json:"pageSize,omitempty"` + + // SortField The field to sort the results by. Defaults to name. + SortField *SecurityEndpointManagementAPIApiSortField `form:"sortField,omitempty" json:"sortField,omitempty"` + + // SortDirection The direction to sort the results by. Defaults to asc (ascending). + SortDirection *SecurityEndpointManagementAPISortDirection `form:"sortDirection,omitempty" json:"sortDirection,omitempty"` + + // Kuery A KQL query string to filter the list of scripts. Nearly all fields in the script object are searchable. + Kuery *string `form:"kuery,omitempty" json:"kuery,omitempty"` +} + // DeleteEndpointListItemParams defines parameters for DeleteEndpointListItem. type DeleteEndpointListItemParams struct { // Id Either `id` or `item_id` must be specified @@ -65370,7 +65438,7 @@ func (t SLOsIndicatorPropertiesTimesliceMetric_Params_Metric_Metrics_Item) AsSLO // FromSLOsTimesliceMetricBasicMetricWithField overwrites any union data inside the SLOsIndicatorPropertiesTimesliceMetric_Params_Metric_Metrics_Item as the provided SLOsTimesliceMetricBasicMetricWithField func (t *SLOsIndicatorPropertiesTimesliceMetric_Params_Metric_Metrics_Item) FromSLOsTimesliceMetricBasicMetricWithField(v SLOsTimesliceMetricBasicMetricWithField) error { - v.Aggregation = "avg" + v.Aggregation = "std_deviation" b, err := json.Marshal(v) t.union = b return err @@ -65378,7 +65446,7 @@ func (t *SLOsIndicatorPropertiesTimesliceMetric_Params_Metric_Metrics_Item) From // MergeSLOsTimesliceMetricBasicMetricWithField performs a merge with any union data inside the SLOsIndicatorPropertiesTimesliceMetric_Params_Metric_Metrics_Item, using the provided SLOsTimesliceMetricBasicMetricWithField func (t *SLOsIndicatorPropertiesTimesliceMetric_Params_Metric_Metrics_Item) MergeSLOsTimesliceMetricBasicMetricWithField(v SLOsTimesliceMetricBasicMetricWithField) error { - v.Aggregation = "avg" + v.Aggregation = "std_deviation" b, err := json.Marshal(v) if err != nil { return err @@ -65459,12 +65527,12 @@ func (t SLOsIndicatorPropertiesTimesliceMetric_Params_Metric_Metrics_Item) Value return nil, err } switch discriminator { - case "avg": - return t.AsSLOsTimesliceMetricBasicMetricWithField() case "doc_count": return t.AsSLOsTimesliceMetricDocCountMetric() case "percentile": return t.AsSLOsTimesliceMetricPercentileMetric() + case "std_deviation": + return t.AsSLOsTimesliceMetricBasicMetricWithField() default: return nil, errors.New("unknown discriminator value: " + discriminator) } @@ -79981,6 +80049,9 @@ type ClientInterface interface { CreateUpdateProtectionUpdatesNote(ctx context.Context, packagePolicyId string, body CreateUpdateProtectionUpdatesNoteJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // EndpointScriptLibraryListScripts request + EndpointScriptLibraryListScripts(ctx context.Context, params *EndpointScriptLibraryListScriptsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // CreateEndpointList request CreateEndpointList(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -83989,6 +84060,18 @@ func (c *Client) CreateUpdateProtectionUpdatesNote(ctx context.Context, packageP return c.Client.Do(req) } +func (c *Client) EndpointScriptLibraryListScripts(ctx context.Context, params *EndpointScriptLibraryListScriptsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewEndpointScriptLibraryListScriptsRequest(c.Server, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) CreateEndpointList(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewCreateEndpointListRequest(c.Server) if err != nil { @@ -98299,6 +98382,119 @@ func NewCreateUpdateProtectionUpdatesNoteRequestWithBody(server string, packageP return req, nil } +// NewEndpointScriptLibraryListScriptsRequest generates requests for EndpointScriptLibraryListScripts +func NewEndpointScriptLibraryListScriptsRequest(server string, params *EndpointScriptLibraryListScriptsParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/api/endpoint/scripts_library") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if params.Page != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "page", runtime.ParamLocationQuery, *params.Page); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.PageSize != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "pageSize", runtime.ParamLocationQuery, *params.PageSize); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.SortField != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "sortField", runtime.ParamLocationQuery, *params.SortField); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.SortDirection != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "sortDirection", runtime.ParamLocationQuery, *params.SortDirection); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.Kuery != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "kuery", runtime.ParamLocationQuery, *params.Kuery); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + // NewCreateEndpointListRequest generates requests for CreateEndpointList func NewCreateEndpointListRequest(server string) (*http.Request, error) { var err error @@ -119436,6 +119632,9 @@ type ClientWithResponsesInterface interface { CreateUpdateProtectionUpdatesNoteWithResponse(ctx context.Context, packagePolicyId string, body CreateUpdateProtectionUpdatesNoteJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateUpdateProtectionUpdatesNoteResponse, error) + // EndpointScriptLibraryListScriptsWithResponse request + EndpointScriptLibraryListScriptsWithResponse(ctx context.Context, params *EndpointScriptLibraryListScriptsParams, reqEditors ...RequestEditorFn) (*EndpointScriptLibraryListScriptsResponse, error) + // CreateEndpointListWithResponse request CreateEndpointListWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*CreateEndpointListResponse, error) @@ -127665,6 +127864,45 @@ func (r CreateUpdateProtectionUpdatesNoteResponse) StatusCode() int { return 0 } +type EndpointScriptLibraryListScriptsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *struct { + Data *[]SecurityEndpointManagementAPIEndpointScript `json:"data,omitempty"` + + // Page Page number + Page *SecurityEndpointManagementAPIPage `json:"page,omitempty"` + + // PageSize Number of items per page + PageSize *SecurityEndpointManagementAPIApiPageSize `json:"pageSize,omitempty"` + + // SortDirection Determines the sort order. + SortDirection *SecurityEndpointManagementAPISortDirection `json:"sortDirection,omitempty"` + + // SortField Determines which field is used to sort the results. + SortField *SecurityEndpointManagementAPIApiSortField `json:"sortField,omitempty"` + + // Total The total number of scripts matching the query + Total *int `json:"total,omitempty"` + } +} + +// Status returns HTTPResponse.Status +func (r EndpointScriptLibraryListScriptsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r EndpointScriptLibraryListScriptsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type CreateEndpointListResponse struct { Body []byte HTTPResponse *http.Response @@ -143299,6 +143537,15 @@ func (c *ClientWithResponses) CreateUpdateProtectionUpdatesNoteWithResponse(ctx return ParseCreateUpdateProtectionUpdatesNoteResponse(rsp) } +// EndpointScriptLibraryListScriptsWithResponse request returning *EndpointScriptLibraryListScriptsResponse +func (c *ClientWithResponses) EndpointScriptLibraryListScriptsWithResponse(ctx context.Context, params *EndpointScriptLibraryListScriptsParams, reqEditors ...RequestEditorFn) (*EndpointScriptLibraryListScriptsResponse, error) { + rsp, err := c.EndpointScriptLibraryListScripts(ctx, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseEndpointScriptLibraryListScriptsResponse(rsp) +} + // CreateEndpointListWithResponse request returning *CreateEndpointListResponse func (c *ClientWithResponses) CreateEndpointListWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*CreateEndpointListResponse, error) { rsp, err := c.CreateEndpointList(ctx, reqEditors...) @@ -154814,6 +155061,49 @@ func ParseCreateUpdateProtectionUpdatesNoteResponse(rsp *http.Response) (*Create return response, nil } +// ParseEndpointScriptLibraryListScriptsResponse parses an HTTP response from a EndpointScriptLibraryListScriptsWithResponse call +func ParseEndpointScriptLibraryListScriptsResponse(rsp *http.Response) (*EndpointScriptLibraryListScriptsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &EndpointScriptLibraryListScriptsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Data *[]SecurityEndpointManagementAPIEndpointScript `json:"data,omitempty"` + + // Page Page number + Page *SecurityEndpointManagementAPIPage `json:"page,omitempty"` + + // PageSize Number of items per page + PageSize *SecurityEndpointManagementAPIApiPageSize `json:"pageSize,omitempty"` + + // SortDirection Determines the sort order. + SortDirection *SecurityEndpointManagementAPISortDirection `json:"sortDirection,omitempty"` + + // SortField Determines which field is used to sort the results. + SortField *SecurityEndpointManagementAPIApiSortField `json:"sortField,omitempty"` + + // Total The total number of scripts matching the query + Total *int `json:"total,omitempty"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + // ParseCreateEndpointListResponse parses an HTTP response from a CreateEndpointListWithResponse call func ParseCreateEndpointListResponse(rsp *http.Response) (*CreateEndpointListResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) diff --git a/generated/kbapi/transform_schema.go b/generated/kbapi/transform_schema.go index 0b804e4c9..93b1cd0e9 100644 --- a/generated/kbapi/transform_schema.go +++ b/generated/kbapi/transform_schema.go @@ -569,6 +569,7 @@ var transformers = []TransformFunc{ fixGetSpacesParams, fixGetSyntheticsMonitorsParams, fixGetMaintenanceWindowFindParams, + fixSecurityAPIPageSize, removeDuplicateOneOfRefs, transformRemoveExamples, transformRemoveUnusedComponents, @@ -955,6 +956,11 @@ func fixGetMaintenanceWindowFindParams(schema *Schema) { schema.MustGetPath("/api/maintenance_window/_find").MustGetEndpoint("get").Move("parameters.2.schema.anyOf.1", "parameters.2.schema") } +func fixSecurityAPIPageSize(schema *Schema) { + apiPageSize := schema.Components.MustGetMap("schemas.Security_Endpoint_Management_API_ApiPageSize") + schema.Components.Set("schemas.Security_Endpoint_Management_API_ApiPageSize", apiPageSize.MustGetMap("allOf.0")) +} + func removeDuplicateOneOfRefs(schema *Schema) { componentSchemas := schema.Components.MustGetMap("schemas") componentSchemas.Iterate(removeDuplicateOneOfRefsFromNode)