Skip to content

Commit

Permalink
[Fleet] Deprecate savedObject from Api responses (#159396)
Browse files Browse the repository at this point in the history
## Summary
- Replacing `savedObject` in the following endpoints with a new object
`installationInfo` that is more "flattened". `savedObject` is marked as
deprecated but not removed for now as it might be used by other
stakeholders.

  - `GET api/fleet/epm/packages/{pkgName}/{version}`
  - `GET api/fleet/epm/packages`
- Replaced all the usages of `savedObject.attributes` in the frontend
with `installationInfo`


### Testing
- in dev tools, run `GET kbn:/api/fleet/epm/packages` and search for a
package that has `savedObject` in it.
- For instance `fleet-server` or `endpoint`, verify that has both
`savedObject` and `installationInfo`:
```
 {
    name: 'endpoint',
    title: 'Elastic Defend',
    version: '8.8.0',
    release: 'ga',
    description: 'Protect your hosts and cloud workloads with threat prevention, detection, and deep security data visibility.',
    type: 'integration',
    download: '/epr/endpoint/endpoint-8.8.0.zip',
    path: '/package/endpoint/8.8.0',
    icons: [ [Object] ],
    policy_templates: [ [Object] ],
    conditions: { kibana: [Object] },
    owner: { github: 'elastic/security-onboarding-and-lifecycle-mgt' },
    categories: [ 'security', 'edr_xdr' ],
    signature_path: '/epr/endpoint/endpoint-8.8.0.zip.sig',
    id: 'endpoint',
    status: 'installed',
    savedObject: {..},
    installationInfo: {
      created_at: '2023-05-25T10:36:47.450Z',
      updated_at: '2023-05-25T10:37:05.168Z',
      version: '8.8.0',
      installed_kibana: [],
      installed_kibana_space_id: 'default',
      installed_es: [Array],
      package_assets: [Array],
      es_index_patterns: [Object],
      name: 'endpoint',
      install_version: '8.8.0',
      install_status: 'installed',
      install_started_at: '2023-05-25T10:36:47.450Z',
      install_source: 'registry',
      install_format_schema_version: '1.0.0',
      verification_status: 'unknown'
    }
  },
```

- Run `GET kbn:/api/fleet/epm/packages/fleet_server/1.3.0` and
verifythat has both `savedObject` and `installationInfo`:
```
{
  "item": {
    "name": "fleet_server",
    "title": "Fleet Server",
    "version": "1.3.0",
    "release": "ga",
    "description": "Centrally manage Elastic Agents with the Fleet Server integration.",
    "type": "integration",
    "download": "/epr/fleet_server/fleet_server-1.3.0.zip",
    "path": "/package/fleet_server/1.3.0",
    "icons": [
      {
        "src": "/img/logo_fleet_server.svg",
        "path": "/package/fleet_server/1.3.0/img/logo_fleet_server.svg",
        "title": "logo Fleet Server",
        "size": "64x64",
        "type": "image/svg+xml"
      }
    ],
    "conditions": {
      "kibana": {
        "version": "^8.8.0"
      }
    },
    "owner": {
      "github": "elastic/elastic-agent-control-plane"
    },
    "categories": [
      "elastic_stack"
    ],
    "signature_path": "/epr/fleet_server/fleet_server-1.3.0.zip.sig",
    "format_version": "1.0.0",
    "readme": "/package/fleet_server/1.3.0/docs/README.md",
    "license": "basic",
    "assets": {},
    "policy_templates": [
      {
        "name": "fleet_server",
        "title": "Fleet Server",
        "description": "Fleet Server setup",
        "inputs": [
          {
            "type": "fleet-server",
            "vars": [... ],
     },
    "latestVersion": "1.3.0",
    "licensePath": "/package/fleet_server/1.3.0/LICENSE.txt",
    "keepPoliciesUpToDate": false,
    "status": "installed",
    "savedObject": {
      "id": "fleet_server",
      "type": "epm-packages",
      "namespaces": [],
      "updated_at": "2023-05-25T10:32:33.033Z",
      "created_at": "2023-05-25T10:32:32.042Z",
      "version": "WzEyNCwxXQ==",
      "attributes": {
        "installed_kibana": [],
        "installed_kibana_space_id": "default",
        "installed_es": [],
        "package_assets": [...],
        "es_index_patterns": {},
        "name": "fleet_server",
        "version": "1.3.0",
        "install_version": "1.3.0",
        "install_status": "installed",
        "install_started_at": "2023-05-25T10:32:32.042Z",
        "install_source": "registry",
        "install_format_schema_version": "1.0.0",
        "verification_status": "unknown"
      },
      "references": [],
      "managed": false,
      "coreMigrationVersion": "8.8.0",
      "typeMigrationVersion": "8.6.0"
    },
    "installationInfo": {
      "created_at": "2023-05-25T10:32:32.042Z",
      "updated_at": "2023-05-25T10:32:33.033Z",
      "version": "1.3.0",
      "namespaces": [],
      "type": "epm-packages",
      "installed_kibana": [],
      "installed_kibana_space_id": "default",
      "installed_es": [],
      "package_assets": [...],
      "es_index_patterns": {},
      "name": "fleet_server",
      "install_version": "1.3.0",
      "install_status": "installed",
      "install_started_at": "2023-05-25T10:32:32.042Z",
      "install_source": "registry",
      "install_format_schema_version": "1.0.0",
      "verification_status": "unknown"
    }
  }
}
```



### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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

---------

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
criamico and kibanamachine authored Jun 13, 2023
1 parent ad2593b commit 7a3ce25
Show file tree
Hide file tree
Showing 25 changed files with 514 additions and 167 deletions.
183 changes: 156 additions & 27 deletions x-pack/plugins/fleet/common/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -5740,6 +5740,159 @@
"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"
]
},
"installation_info": {
"title": "Installation info object",
"type": "object",
"properties": {
"type": {
"type": "string"
},
"created_at": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"namespaces": {
"type": "array",
"items": {
"type": "string"
}
},
"installed_kibana": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"type": {
"$ref": "#/components/schemas/kibana_saved_object_type"
}
}
},
"installed_es": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"deferred": {
"type": "boolean"
},
"type": {
"$ref": "#/components/schemas/elasticsearch_asset_type"
}
}
},
"name": {
"type": "string"
},
"version": {
"type": "string"
},
"install_status": {
"type": "string",
"enum": [
"installed",
"installing",
"install_failed"
]
},
"install_source": {
"type": "string",
"enum": [
"registry",
"upload",
"bundled"
]
},
"install_kibana_space_id": {
"type": "string"
},
"install_format_schema_version": {
"type": "string"
},
"verification_status": {
"type": "string",
"enum": [
"verified",
"unverified",
"unknown"
]
},
"verification_key_id": {
"type": "string",
"nullable": true
},
"experimental_data_stream_features": {
"type": "array",
"properties": {
"data_stream": {
"type": "string"
},
"features": {
"type": "object",
"properties": {
"synthetic_source": {
"type": "boolean",
"nullable": true
},
"tsdb": {
"type": "boolean",
"nullable": true
},
"doc_value_only_numeric": {
"type": "boolean",
"nullable": true
},
"doc_value_only_other": {
"type": "boolean",
"nullable": true
}
}
}
}
}
},
"required": [
"installed_kibana",
"installed_es",
"name",
"version",
"install_status",
"install_version",
"install_started_at",
"install_source",
"verification_status"
]
},
"search_result": {
"title": "Search result",
"type": "object",
Expand Down Expand Up @@ -5771,6 +5924,9 @@
"status": {
"type": "string"
},
"installationInfo": {
"$ref": "#/components/schemas/installation_info"
},
"savedObject": {
"type": "object",
"deprecated": true
Expand Down Expand Up @@ -5810,33 +5966,6 @@
"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
137 changes: 114 additions & 23 deletions x-pack/plugins/fleet/common/openapi/bundled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3602,6 +3602,118 @@ components:
- count
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
installation_info:
title: Installation info object
type: object
properties:
type:
type: string
created_at:
type: string
updated_at:
type: string
namespaces:
type: array
items:
type: string
installed_kibana:
type: object
properties:
id:
type: string
type:
$ref: '#/components/schemas/kibana_saved_object_type'
installed_es:
type: object
properties:
id:
type: string
deferred:
type: boolean
type:
$ref: '#/components/schemas/elasticsearch_asset_type'
name:
type: string
version:
type: string
install_status:
type: string
enum:
- installed
- installing
- install_failed
install_source:
type: string
enum:
- registry
- upload
- bundled
install_kibana_space_id:
type: string
install_format_schema_version:
type: string
verification_status:
type: string
enum:
- verified
- unverified
- unknown
verification_key_id:
type: string
nullable: true
experimental_data_stream_features:
type: array
properties:
data_stream:
type: string
features:
type: object
properties:
synthetic_source:
type: boolean
nullable: true
tsdb:
type: boolean
nullable: true
doc_value_only_numeric:
type: boolean
nullable: true
doc_value_only_other:
type: boolean
nullable: true
required:
- installed_kibana
- installed_es
- name
- version
- install_status
- install_version
- install_started_at
- install_source
- verification_status
search_result:
title: Search result
type: object
Expand All @@ -3624,6 +3736,8 @@ components:
type: string
status:
type: string
installationInfo:
$ref: '#/components/schemas/installation_info'
savedObject:
type: object
deprecated: true
Expand Down Expand Up @@ -3652,29 +3766,6 @@ 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
Loading

0 comments on commit 7a3ce25

Please sign in to comment.