kibana icon indicating copy to clipboard operation
kibana copied to clipboard

[Fleet] added format parameter to agent_policies APIs

Open juliaElastic opened this issue 1 year ago • 4 comments

Summary

Closes https://github.com/elastic/kibana/issues/161625

Support simplified format in agent_policies APIs when the response contains package_policies.

API endpoints updated:

# Get all
GET kbn:/api/fleet/agent_policies?full=true&format=simplified
# Bulk get
POST kbn:/api/fleet/agent_policies/_bulk_get?format=simplified
     {
      "ids": ["fleet-server-policy"],
      "full": true
     }
# Get one
GET kbn:/api/fleet/agent_policies/fleet-server-policy?format=simplified
# Update
PUT kbn:/api/fleet/agent_policies/fleet-server-policy?format=simplified
    {
      "name": "Fleet Server Policy",
      "namespace": "default"
    }
# Copy
POST kbn:/api/fleet/agent_policies/fleet-server-policy/copy?format=simplified
         {
      "name": "Fleet Server Policy (copy)"
    }

# Example response

{
  "items": [
    {
      "id": "fleet-server-policy",
      "version": "WzIxMzIsMV0=",
      "description": "Fleet Server policy generated by Kibana",
      "is_default_fleet_server": true,
      "monitoring_enabled": [
        "logs",
        "metrics"
      ],
      "inactivity_timeout": 1209600,
      "schema_version": "1.1.1",
      "package_policies": [
        {
          "id": "8cb17156-d295-475e-9ec8-44ef138a5d49",
          "version": "WzIwNzYsMV0=",
          "name": "system-3",
          "namespace": "default",
          "package": {
            "name": "system",
            "title": "System",
            "version": "1.60.3",
            "requires_root": true
          },
          "enabled": true,
          "policy_id": "fleet-server-policy",
          "policy_ids": [
            "fleet-server-policy"
          ],
          "inputs": {
            "system-logfile": {
              "enabled": true,
              "streams": {
                "system.auth": {
                  "enabled": true,
                  "vars": {
                    "ignore_older": "72h",
                    "paths": [
                      "/var/log/auth.log*",
                      "/var/log/secure*"
                    ],
                    "preserve_original_event": false,
                    "tags": [
                      "system-auth"
                    ]
                  }
                },

Create and Delete APIs don't return package policies, so didn't change those. Also didn't update the kbn:/api/fleet/agent_policies/fleet-server-policy/full path, it has a different format.

Checklist

juliaElastic avatar Aug 30 '24 09:08 juliaElastic

/ci

juliaElastic avatar Aug 30 '24 09:08 juliaElastic

:robot: GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

obltmachine avatar Aug 30 '24 09:08 obltmachine

Pinging @elastic/fleet (Team:Fleet)

elasticmachine avatar Aug 30 '24 13:08 elasticmachine

:green_heart: Build Succeeded

Metrics [docs]

✅ unchanged

History

  • :yellow_heart: Build #231056 was flaky fdd8df99657a67ec16bd54e28cb6ac3201f76851

To update your PR or re-run it, just comment with: @elasticmachine merge upstream

cc @juliaElastic

kibana-ci avatar Aug 30 '24 14:08 kibana-ci