Skip to content

Commit

Permalink
[Fleet] added more upload tests and openapi (elastic#150743)
Browse files Browse the repository at this point in the history
## Summary

Related to elastic#148599

Added more integration tests.

Added openapi spec.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

(cherry picked from commit 486d56b)
  • Loading branch information
juliaElastic committed Feb 10, 2023
1 parent fb3d691 commit 33193bb
Show file tree
Hide file tree
Showing 5 changed files with 378 additions and 142 deletions.
194 changes: 135 additions & 59 deletions x-pack/plugins/fleet/common/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,44 +325,120 @@
}
}
},
"operationId": "list-all-packages"
},
"parameters": [
{
"in": "query",
"name": "excludeInstallStatus",
"schema": {
"type": "boolean",
"default": false
"operationId": "list-all-packages",
"parameters": [
{
"in": "query",
"name": "excludeInstallStatus",
"schema": {
"type": "boolean",
"default": false
},
"description": "Whether to exclude the install status of each package. Enabling this option will opt in to caching for the response via `cache-control` headers. If you don't need up-to-date installation info for a package, and are querying for a list of available packages, providing this flag can improve performance substantially."
},
"description": "Whether to exclude the install status of each package. Enabling this option will opt in to caching for the response via `cache-control` headers. If you don't need up-to-date installation info for a package, and are querying for a list of available packages, providing this flag can improve performance substantially."
},
{
"in": "query",
"name": "prerelease",
"schema": {
"type": "boolean",
"default": false
{
"in": "query",
"name": "prerelease",
"schema": {
"type": "boolean",
"default": false
},
"description": "Whether to return prerelease versions of packages (e.g. beta, rc, preview) "
},
"description": "Whether to return prerelease versions of packages (e.g. beta, rc, preview) "
},
{
"in": "query",
"name": "experimental",
"deprecated": true,
"schema": {
"type": "boolean",
"default": false
{
"in": "query",
"name": "experimental",
"deprecated": true,
"schema": {
"type": "boolean",
"default": false
}
},
{
"in": "query",
"name": "category",
"schema": {
"type": "string"
}
}
]
},
"post": {
"summary": "Packages - Install by upload",
"tags": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"type": {
"oneOf": [
{
"$ref": "#/components/schemas/kibana_saved_object_type"
},
{
"$ref": "#/components/schemas/elasticsearch_asset_type"
}
]
}
},
"required": [
"id",
"type"
]
}
},
"_meta": {
"type": "object",
"properties": {
"install_source": {
"type": "string",
"enum": [
"upload",
"registry",
"bundled"
]
}
}
}
},
"required": [
"items"
]
}
}
}
}
},
{
"in": "query",
"name": "category",
"schema": {
"type": "string"
"operationId": "install-package-by-upload",
"description": "",
"parameters": [
{
"$ref": "#/components/parameters/kbn_xsrf"
}
],
"requestBody": {
"content": {
"application/zip": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
}
]
}
},
"/epm/packages/_bulk": {
"post": {
Expand Down Expand Up @@ -4870,6 +4946,33 @@
"items"
]
},
"kibana_saved_object_type": {
"title": "Kibana saved object asset type",
"type": "string",
"enum": [
"dashboard",
"visualization",
"search",
"index-pattern",
"map",
"lens",
"ml-module",
"security-rule",
"csp_rule_template"
]
},
"elasticsearch_asset_type": {
"title": "Elasticsearch asset type",
"type": "string",
"enum": [
"component_template",
"ingest_pipeline",
"index_template",
"ilm_policy",
"transform",
"data_stream_ilm_policy"
]
},
"bulk_install_packages_response": {
"title": "Bulk install packages response",
"type": "object",
Expand Down Expand Up @@ -5119,33 +5222,6 @@
"path"
]
},
"kibana_saved_object_type": {
"title": "Kibana saved object asset type",
"type": "string",
"enum": [
"dashboard",
"visualization",
"search",
"index-pattern",
"map",
"lens",
"ml-module",
"security-rule",
"csp_rule_template"
]
},
"elasticsearch_asset_type": {
"title": "Elasticsearch asset type",
"type": "string",
"enum": [
"component_template",
"ingest_pipeline",
"index_template",
"ilm_policy",
"transform",
"data_stream_ilm_policy"
]
},
"package_usage_stats": {
"title": "Package usage stats",
"type": "object",
Expand Down
152 changes: 99 additions & 53 deletions x-pack/plugins/fleet/common/openapi/bundled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -205,36 +205,82 @@ paths:
schema:
$ref: '#/components/schemas/get_packages_response'
operationId: list-all-packages
parameters:
- in: query
name: excludeInstallStatus
schema:
type: boolean
default: false
description: >-
Whether to exclude the install status of each package. Enabling this
option will opt in to caching for the response via `cache-control`
headers. If you don't need up-to-date installation info for a package,
and are querying for a list of available packages, providing this flag
can improve performance substantially.
- in: query
name: prerelease
schema:
type: boolean
default: false
description: >-
Whether to return prerelease versions of packages (e.g. beta, rc,
preview)
- in: query
name: experimental
deprecated: true
schema:
type: boolean
default: false
- in: query
name: category
schema:
type: string
parameters:
- in: query
name: excludeInstallStatus
schema:
type: boolean
default: false
description: >-
Whether to exclude the install status of each package. Enabling this
option will opt in to caching for the response via `cache-control`
headers. If you don't need up-to-date installation info for a
package, and are querying for a list of available packages,
providing this flag can improve performance substantially.
- in: query
name: prerelease
schema:
type: boolean
default: false
description: >-
Whether to return prerelease versions of packages (e.g. beta, rc,
preview)
- in: query
name: experimental
deprecated: true
schema:
type: boolean
default: false
- in: query
name: category
schema:
type: string
post:
summary: Packages - Install by upload
tags: []
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
items:
type: array
items:
type: object
properties:
id:
type: string
type:
oneOf:
- $ref: '#/components/schemas/kibana_saved_object_type'
- $ref: '#/components/schemas/elasticsearch_asset_type'
required:
- id
- type
_meta:
type: object
properties:
install_source:
type: string
enum:
- upload
- registry
- bundled
required:
- items
operationId: install-package-by-upload
description: ''
parameters:
- $ref: '#/components/parameters/kbn_xsrf'
requestBody:
content:
application/zip:
schema:
type: string
format: binary
/epm/packages/_bulk:
post:
summary: Packages - Bulk install
Expand Down Expand Up @@ -3047,6 +3093,29 @@ components:
$ref: '#/components/schemas/search_result'
required:
- items
kibana_saved_object_type:
title: Kibana saved object asset type
type: string
enum:
- dashboard
- visualization
- search
- index-pattern
- map
- lens
- ml-module
- security-rule
- csp_rule_template
elasticsearch_asset_type:
title: Elasticsearch asset type
type: string
enum:
- component_template
- ingest_pipeline
- index_template
- ilm_policy
- transform
- data_stream_ilm_policy
bulk_install_packages_response:
title: Bulk install packages response
type: object
Expand Down Expand Up @@ -3220,29 +3289,6 @@ components:
- format_version
- download
- path
kibana_saved_object_type:
title: Kibana saved object asset type
type: string
enum:
- dashboard
- visualization
- search
- index-pattern
- map
- lens
- ml-module
- security-rule
- csp_rule_template
elasticsearch_asset_type:
title: Elasticsearch asset type
type: string
enum:
- component_template
- ingest_pipeline
- index_template
- ilm_policy
- transform
- data_stream_ilm_policy
package_usage_stats:
title: Package usage stats
type: object
Expand Down
Loading

0 comments on commit 33193bb

Please sign in to comment.