[Fleet] Fix OpenAPI for agent policy (#152108)

This commit is contained in:
Nicolas Chaulet 2023-02-24 10:40:29 -05:00 committed by GitHub
parent eb9cc11a7c
commit e1f73db5bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 525 additions and 280 deletions

View file

@ -2689,7 +2689,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/new_agent_policy"
"$ref": "#/components/schemas/agent_policy_create_request"
}
}
}
@ -2774,7 +2774,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/new_agent_policy"
"$ref": "#/components/schemas/agent_policy_update_request"
}
}
}
@ -5956,60 +5956,6 @@
}
}
},
"new_agent_policy": {
"title": "New agent policy",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"namespace": {
"type": "string"
},
"description": {
"type": "string"
},
"monitoring_enabled": {
"type": "array",
"items": {
"type": "string",
"enum": [
"metrics",
"logs"
]
}
},
"data_output_id": {
"type": "string",
"nullable": true
},
"monitoring_output_id": {
"type": "string",
"nullable": true
},
"fleet_server_host_id": {
"type": "string",
"nullable": true
},
"download_source_id": {
"type": "string",
"nullable": true
},
"unenroll_timeout": {
"type": "number"
},
"inactivity_timeout": {
"type": "number"
}
},
"required": [
"name",
"namespace"
]
},
"new_package_policy": {
"title": "New package policy",
"type": "object",
@ -6120,36 +6066,30 @@
]
},
"agent_policy": {
"allOf": [
{
"$ref": "#/components/schemas/new_agent_policy"
},
{
"title": "Agent Policy",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"active",
"inactive"
]
"name": {
"type": "string"
},
"package_policies": {
"description": "This field is present only when retrieving a single agent policy, or when retrieving a list of agent policy with the ?full=true parameter",
"namespace": {
"type": "string"
},
"description": {
"type": "string"
},
"monitoring_enabled": {
"type": "array",
"items": {
"$ref": "#/components/schemas/package_policy"
}
},
"updated_on": {
"type": "string",
"format": "date-time"
},
"updated_by": {
"type": "string"
"enum": [
"metrics",
"logs"
]
}
},
"data_output_id": {
"type": "string",
@ -6167,6 +6107,26 @@
"type": "string",
"nullable": true
},
"unenroll_timeout": {
"type": "number"
},
"inactivity_timeout": {
"type": "number"
},
"package_policies": {
"description": "This field is present only when retrieving a single agent policy, or when retrieving a list of agent policy with the ?full=true parameter",
"type": "array",
"items": {
"$ref": "#/components/schemas/package_policy"
}
},
"updated_on": {
"type": "string",
"format": "date-time"
},
"updated_by": {
"type": "string"
},
"revision": {
"type": "number"
},
@ -6194,9 +6154,150 @@
},
"required": [
"id",
"status"
"status",
"name",
"namespace"
]
},
"agent_policy_create_request": {
"title": "Create agent policy request",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"namespace": {
"type": "string"
},
"description": {
"type": "string"
},
"monitoring_enabled": {
"type": "array",
"items": {
"type": "string",
"enum": [
"metrics",
"logs"
]
}
},
"data_output_id": {
"type": "string",
"nullable": true
},
"monitoring_output_id": {
"type": "string",
"nullable": true
},
"fleet_server_host_id": {
"type": "string",
"nullable": true
},
"download_source_id": {
"type": "string",
"nullable": true
},
"unenroll_timeout": {
"type": "number"
},
"inactivity_timeout": {
"type": "number"
},
"agent_features": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"enabled": {
"type": "boolean"
}
},
"required": [
"name",
"enabled"
]
}
}
},
"required": [
"name",
"namespace"
]
},
"agent_policy_update_request": {
"title": "Update agent policy request",
"type": "object",
"properties": {
"name": {
"type": "string"
},
"namespace": {
"type": "string"
},
"description": {
"type": "string"
},
"monitoring_enabled": {
"type": "array",
"items": {
"type": "string",
"enum": [
"metrics",
"logs"
]
}
},
"data_output_id": {
"type": "string",
"nullable": true
},
"monitoring_output_id": {
"type": "string",
"nullable": true
},
"fleet_server_host_id": {
"type": "string",
"nullable": true
},
"download_source_id": {
"type": "string",
"nullable": true
},
"unenroll_timeout": {
"type": "number"
},
"inactivity_timeout": {
"type": "number"
},
"agent_features": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"enabled": {
"type": "boolean"
}
},
"required": [
"name",
"enabled"
]
}
}
},
"required": [
"name",
"namespace"
]
},
"full_agent_policy_output": {

View file

@ -1675,7 +1675,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/new_agent_policy'
$ref: '#/components/schemas/agent_policy_create_request'
security: []
parameters:
- $ref: '#/components/parameters/kbn_xsrf'
@ -1728,7 +1728,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/new_agent_policy'
$ref: '#/components/schemas/agent_policy_update_request'
parameters:
- $ref: '#/components/parameters/kbn_xsrf'
/agent_policies/{agentPolicyId}/copy:
@ -3797,44 +3797,6 @@ components:
type: array
items:
type: string
new_agent_policy:
title: New agent policy
type: object
properties:
id:
type: string
name:
type: string
namespace:
type: string
description:
type: string
monitoring_enabled:
type: array
items:
type: string
enum:
- metrics
- logs
data_output_id:
type: string
nullable: true
monitoring_output_id:
type: string
nullable: true
fleet_server_host_id:
type: string
nullable: true
download_source_id:
type: string
nullable: true
unenroll_timeout:
type: number
inactivity_timeout:
type: number
required:
- name
- namespace
new_package_policy:
title: New package policy
type: object
@ -3908,30 +3870,24 @@ components:
- revision
- $ref: '#/components/schemas/new_package_policy'
agent_policy:
allOf:
- $ref: '#/components/schemas/new_agent_policy'
- type: object
title: Agent Policy
type: object
properties:
id:
type: string
status:
name:
type: string
enum:
- active
- inactive
package_policies:
description: >-
This field is present only when retrieving a single agent
policy, or when retrieving a list of agent policy with the
?full=true parameter
namespace:
type: string
description:
type: string
monitoring_enabled:
type: array
items:
$ref: '#/components/schemas/package_policy'
updated_on:
type: string
format: date-time
updated_by:
type: string
enum:
- metrics
- logs
data_output_id:
type: string
nullable: true
@ -3944,6 +3900,22 @@ components:
download_source_id:
type: string
nullable: true
unenroll_timeout:
type: number
inactivity_timeout:
type: number
package_policies:
description: >-
This field is present only when retrieving a single agent policy, or
when retrieving a list of agent policy with the ?full=true parameter
type: array
items:
$ref: '#/components/schemas/package_policy'
updated_on:
type: string
format: date-time
updated_by:
type: string
revision:
type: number
agents:
@ -3963,6 +3935,106 @@ components:
required:
- id
- status
- name
- namespace
agent_policy_create_request:
title: Create agent policy request
type: object
properties:
id:
type: string
name:
type: string
namespace:
type: string
description:
type: string
monitoring_enabled:
type: array
items:
type: string
enum:
- metrics
- logs
data_output_id:
type: string
nullable: true
monitoring_output_id:
type: string
nullable: true
fleet_server_host_id:
type: string
nullable: true
download_source_id:
type: string
nullable: true
unenroll_timeout:
type: number
inactivity_timeout:
type: number
agent_features:
type: array
items:
type: object
properties:
name:
type: string
enabled:
type: boolean
required:
- name
- enabled
required:
- name
- namespace
agent_policy_update_request:
title: Update agent policy request
type: object
properties:
name:
type: string
namespace:
type: string
description:
type: string
monitoring_enabled:
type: array
items:
type: string
enum:
- metrics
- logs
data_output_id:
type: string
nullable: true
monitoring_output_id:
type: string
nullable: true
fleet_server_host_id:
type: string
nullable: true
download_source_id:
type: string
nullable: true
unenroll_timeout:
type: number
inactivity_timeout:
type: number
agent_features:
type: array
items:
type: object
properties:
name:
type: string
enabled:
type: boolean
required:
- name
- enabled
required:
- name
- namespace
full_agent_policy_output:
title: Full agent policy
type: object

View file

@ -1,24 +1,21 @@
allOf:
- $ref: ./new_agent_policy.yaml
- type: object
properties:
title: Agent Policy
type: object
properties:
id:
type: string
status:
name:
type: string
enum:
- active
- inactive
package_policies:
description: This field is present only when retrieving a single agent policy, or when retrieving a list of agent policy with the ?full=true parameter
namespace:
type: string
description:
type: string
monitoring_enabled:
type: array
items:
$ref: ./package_policy.yaml
updated_on:
type: string
format: date-time
updated_by:
type: string
enum:
- metrics
- logs
data_output_id:
type: string
nullable: true
@ -31,6 +28,20 @@ allOf:
download_source_id:
type: string
nullable: true
unenroll_timeout:
type: number
inactivity_timeout:
type: number
package_policies:
description: This field is present only when retrieving a single agent policy, or when retrieving a list of agent policy with the ?full=true parameter
type: array
items:
$ref: ./package_policy.yaml
updated_on:
type: string
format: date-time
updated_by:
type: string
revision:
type: number
agents:
@ -47,6 +58,8 @@ allOf:
required:
- name
- enabled
required:
required:
- id
- status
- name
- namespace

View file

@ -1,4 +1,4 @@
title: New agent policy
title: Create agent policy request
type: object
properties:
id:
@ -32,6 +32,18 @@ properties:
type: number
inactivity_timeout:
type: number
agent_features:
type: array
items:
type: object
properties:
name:
type: string
enabled:
type: boolean
required:
- name
- enabled
required:
- name
- namespace

View file

@ -0,0 +1,47 @@
title: Update agent policy request
type: object
properties:
name:
type: string
namespace:
type: string
description:
type: string
monitoring_enabled:
type: array
items:
type: string
enum:
- metrics
- logs
data_output_id:
type: string
nullable: true
monitoring_output_id:
type: string
nullable: true
fleet_server_host_id:
type: string
nullable: true
download_source_id:
type: string
nullable: true
unenroll_timeout:
type: number
inactivity_timeout:
type: number
agent_features:
type: array
items:
type: object
properties:
name:
type: string
enabled:
type: boolean
required:
- name
- enabled
required:
- name
- namespace

View file

@ -63,7 +63,7 @@ post:
content:
application/json:
schema:
$ref: ../components/schemas/new_agent_policy.yaml
$ref: ../components/schemas/agent_policy_create_request.yaml
security: []
parameters:
- $ref: ../components/headers/kbn_xsrf.yaml

View file

@ -46,6 +46,6 @@ put:
content:
application/json:
schema:
$ref: ../components/schemas/new_agent_policy.yaml
$ref: ../components/schemas/agent_policy_update_request.yaml
parameters:
- $ref: ../components/headers/kbn_xsrf.yaml