From edb4183ccb504c6b4562eb634ee58c225815bdf9 Mon Sep 17 00:00:00 2001 From: Tor Colvin Date: Tue, 3 Sep 2024 16:32:06 -0400 Subject: [PATCH] CBG-4226 remove oneOf/allOf This is a temporary backstop to generate docs for 3.2 --- docs/api/components/schemas.yaml | 469 ++++++++++++++------- docs/api/paths/admin/db-_config-audit.yaml | 107 ++++- 2 files changed, 425 insertions(+), 151 deletions(-) diff --git a/docs/api/components/schemas.yaml b/docs/api/components/schemas.yaml index 6bdfb7e8ad..cb293789df 100644 --- a/docs/api/components/schemas.yaml +++ b/docs/api/components/schemas.yaml @@ -1859,6 +1859,7 @@ Database: items: type: number example: [1234, 5678] + # DOC-12510 can't use allOf here to use ref: '#/AuditUserRoles' disabled_users: description: List of users for which audit logging is disabled type: array @@ -1866,26 +1867,81 @@ Database: type: object properties: domain: - description: The domain of the user for which audit logging is disabled. + description: The domain of the user for which audit logging is disabled. Either sgw or cbs. type: string name: description: The name of the user for which audit logging is disabled. type: string disabled_roles: - description: List of roles for which audit logging is disabled + description: List of roles for which audit logging is disabled. type: array items: type: object properties: domain: - description: The domain of the role for which audit logging is disabled. + description: The domain of the role for which audit logging is disabled. Either sgw or cbs. type: string name: description: The name of the role for which audit logging is disabled. type: string title: Database-config +Audit-User-Roles: + type: object + properties: + disabled_users: + description: List of users for which audit logging is disabled + type: array + items: + type: object + properties: + domain: + description: The domain of the user for which audit logging is disabled. Either sgw or cbs. + type: string + name: + description: The name of the user for which audit logging is disabled. + type: string + disabled_roles: + description: List of roles for which audit logging is disabled. + type: array + items: + type: object + properties: + domain: + description: The domain of the role for which audit logging is disabled. Either sgw or cbs. + type: string + name: + description: The name of the role for which audit logging is disabled. + type: string +Database-Get-Audit: + title: "Simple" + allOf: + - type: object + properties: + enabled: + type: boolean + events: + type: object + additionalProperties: + x-additionalPropertiesName: audit_id + description: The audit event ID and whether it is enabled or not. + type: boolean + - $ref: '#/Audit-User-Roles' +Database-Get-Audit-Verbose: + title: "Verbose" + allOf: + - type: object + properties: + enabled: + type: boolean + events: + type: object + additionalProperties: + x-additionalPropertiesName: audit_id + description: The audit event ID and whether it is enabled or not. + $ref: '#/AuditEventVerbose' + - $ref: '#/Audit-User-Roles' Database-audit: - title: Database-audit + title: 'Simple' description: A map of audit events and whether they are enabled or not. type: object properties: @@ -1898,7 +1954,7 @@ Database-audit: description: The audit event ID and whether it is enabled or not. type: boolean Database-audit-verbose: - title: Database-audit-verbose + title: 'Verbose' description: A map of detailed audit events. type: object properties: @@ -2375,119 +2431,233 @@ Logging-config: console: $ref: '#/Console-logging-config' error: - allOf: - - $ref: '#/File-logging-config-base' - - type: object + type: object + properties: + enabled: + description: Toggle for this log output + type: boolean + default: false + rotation: + type: object properties: - rotation: - allOf: - - $ref: '#/Log-rotation-base' - - type: object - properties: - max_age: - description: The maximum number of days to retain old log files. - default: 360 - type: integer - collation_buffer_size: - description: The size of the log collation buffer. - default: 10 + max_size: + description: The maximum size in MB of the log file before it gets rotated. + type: integer + default: 100 + localtime: + description: 'If true, it uses the computer''s local time to format the backup timestamp.' + type: boolean + default: false + rotated_logs_size_limit: + description: Max Size (in mb) of log files before deletion type: integer - readOnly: true + default: 1024 + rotation_interval: + description: |- + If set, the interval at which log files are rotated, even if max_size is not reached. + + This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be `5h20m30s`. + type: string + default: 0 + max_age: + description: The maximum number of days to retain old log files. + default: 360 + type: integer + collation_buffer_size: + description: The size of the log collation buffer. + default: 1000 + type: integer + readOnly: true warn: - allOf: - - $ref: '#/File-logging-config-base' - - type: object + type: object + properties: + enabled: + description: Toggle for this log output + type: boolean + default: false + rotation: + type: object properties: - rotation: - allOf: - - $ref: '#/Log-rotation-base' - - type: object - properties: - max_age: - description: The maximum number of days to retain old log files. - default: 180 - type: integer - collation_buffer_size: - description: The size of the log collation buffer - default: 1000 + max_size: + description: The maximum size in MB of the log file before it gets rotated. + type: integer + default: 100 + localtime: + description: 'If true, it uses the computer''s local time to format the backup timestamp.' + type: boolean + default: false + rotated_logs_size_limit: + description: Max Size (in mb) of log files before deletion type: integer - readOnly: true + default: 1024 + rotation_interval: + description: |- + If set, the interval at which log files are rotated, even if max_size is not reached. + + This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be `5h20m30s`. + type: string + default: 0 + max_age: + description: The maximum number of days to retain old log files. + default: 180 + type: integer + collation_buffer_size: + description: The size of the log collation buffer + default: 1000 + type: integer + readOnly: true info: - allOf: - - $ref: '#/File-logging-config-base' - - type: object + type: object + properties: + enabled: + description: Toggle for this log output + type: boolean + default: false + rotation: + type: object properties: - rotation: - allOf: - - $ref: '#/Log-rotation-base' - - type: object - properties: - max_age: - description: The maximum number of days to retain old log files. - default: 6 - type: integer - collation_buffer_size: - description: The size of the log collation buffer - default: 1000 + max_size: + description: The maximum size in MB of the log file before it gets rotated. + type: integer + default: 100 + localtime: + description: 'If true, it uses the computer''s local time to format the backup timestamp.' + type: boolean + default: false + rotated_logs_size_limit: + description: Max Size (in mb) of log files before deletion + type: integer + default: 1024 + rotation_interval: + description: |- + If set, the interval at which log files are rotated, even if max_size is not reached. + + This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be `5h20m30s`. + type: string + default: 0 + max_age: + description: The maximum number of days to retain old log files. + default: 6 type: integer - readOnly: true + collation_buffer_size: + description: The size of the log collation buffer + default: 1000 + type: integer + readOnly: true debug: - allOf: - - $ref: '#/File-logging-config-base' - - type: object + type: object + properties: + enabled: + description: Toggle for this log output + type: boolean + default: false + rotation: + type: object properties: - rotation: - allOf: - - $ref: '#/Log-rotation-base' - - type: object - properties: - max_age: - description: The maximum number of days to retain old log files. - default: 2 - type: integer - collation_buffer_size: - description: The size of the log collation buffer + max_size: + description: The maximum size in MB of the log file before it gets rotated. + type: integer + default: 100 + localtime: + description: 'If true, it uses the computer''s local time to format the backup timestamp.' + type: boolean + default: false + rotated_logs_size_limit: + description: Max Size (in mb) of log files before deletion + type: integer + default: 1024 + rotation_interval: + description: |- + If set, the interval at which log files are rotated, even if max_size is not reached. + + This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be `5h20m30s`. + type: string default: 0 + max_age: + description: The maximum number of days to retain old log files. + default: 2 type: integer - readOnly: true + collation_buffer_size: + description: The size of the log collation buffer + default: 0 + type: integer + readOnly: true trace: - allOf: - - $ref: '#/File-logging-config-base' - - type: object + type: object + properties: + enabled: + description: Toggle for this log output + type: boolean + default: false + rotation: + type: object properties: - rotation: - allOf: - - $ref: '#/Log-rotation-base' - - type: object - properties: - max_age: - description: The maximum number of days to retain old log files. - default: 2 - type: integer - collation_buffer_size: - description: The size of the log collation buffer + max_size: + description: The maximum size in MB of the log file before it gets rotated. + type: integer + default: 100 + localtime: + description: 'If true, it uses the computer''s local time to format the backup timestamp.' + type: boolean + default: false + rotated_logs_size_limit: + description: Max Size (in mb) of log files before deletion + type: integer + default: 1024 + rotation_interval: + description: |- + If set, the interval at which log files are rotated, even if max_size is not reached. + + This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be `5h20m30s`. + type: string default: 0 + max_age: + description: The maximum number of days to retain old log files. + default: 2 type: integer - readOnly: true + collation_buffer_size: + description: The size of the log collation buffer + default: 0 + type: integer + readOnly: true stats: - allOf: - - $ref: '#/File-logging-config-base' - - type: object + type: object + properties: + enabled: + description: Toggle for this log output + type: boolean + default: false + rotation: + type: object properties: - rotation: - allOf: - - $ref: '#/Log-rotation-base' - - type: object - properties: - max_age: - description: The maximum number of days to retain old log files. - default: 6 - type: integer - collation_buffer_size: - description: The size of the log collation buffer + max_size: + description: The maximum size in MB of the log file before it gets rotated. + type: integer + default: 100 + localtime: + description: 'If true, it uses the computer''s local time to format the backup timestamp.' + type: boolean + default: false + rotated_logs_size_limit: + description: Max Size (in mb) of log files before deletion + type: integer + default: 1024 + rotation_interval: + description: |- + If set, the interval at which log files are rotated, even if max_size is not reached. + + This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be `5h20m30s`. + type: string default: 0 + max_age: + description: The maximum number of days to retain old log files. + default: 6 type: integer - readOnly: true + collation_buffer_size: + description: The size of the log collation buffer + default: 0 + type: integer + readOnly: true audit: $ref: '#/Audit-logging-config' File-logging-config-base: @@ -2499,19 +2669,6 @@ File-logging-config-base: default: false title: File-logging-config Audit-logging-config: - allOf: - - $ref: '#/File-logging-config-base' - - type: object - properties: - rotation: - allOf: - - $ref: '#/Log-rotation-base' - - type: object - properties: - max_age: - description: The maximum number of days to retain old log files. - default: 6 - type: integer type: object properties: audit_log_file_path: @@ -2525,34 +2682,38 @@ Audit-logging-config: type: number example: [1234, 5678] readOnly: true - title: Audit-logging-config -Log-rotation-base: - type: object - properties: - max_size: - description: The maximum size in MB of the log file before it gets rotated. - type: integer - default: 100 - localtime: - description: 'If true, it uses the computer''s local time to format the backup timestamp.' - type: boolean - default: false - rotated_logs_size_limit: - description: Max Size (in mb) of log files before deletion - type: integer - default: 1024 - rotation_interval: - description: |- - If set, the interval at which log files are rotated, even if max_size is not reached. + rotation: + type: object + properties: + max_size: + description: The maximum size in MB of the log file before it gets rotated. + type: integer + default: 100 + localtime: + description: 'If true, it uses the computer''s local time to format the backup timestamp.' + type: boolean + default: false + rotated_logs_size_limit: + description: Max Size (in mb) of log files before deletion + type: integer + default: 1024 + rotation_interval: + description: |- + If set, the interval at which log files are rotated, even if max_size is not reached. - This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be `5h20m30s`. - type: string - default: 0 - readOnly: true - title: Log-rotation-config -Log-rotation-config: - allOf: - - $ref: '#/Log-rotation-base' + This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be `5h20m30s`. + type: string + default: 0 + max_age: + description: The maximum number of days to retain old log files. + default: 2 + type: integer + collation_buffer_size: + description: The size of the log collation buffer + default: 1000 + type: integer + readOnly: true + title: Audit-logging-config Console-logging-config: type: object properties: @@ -2587,14 +2748,30 @@ Console-logging-config: default: false readOnly: true rotation: - allOf: - - $ref: '#/Log-rotation-base' - - type: object - properties: - max_age: - description: The maximum number of days to retain old log files. By default, there is no rotation, max_age=0. - default: 0 - type: integer + properties: + max_size: + description: The maximum size in MB of the log file before it gets rotated. + type: integer + default: 100 + localtime: + description: 'If true, it uses the computer''s local time to format the backup timestamp.' + type: boolean + default: false + rotated_logs_size_limit: + description: Max Size (in mb) of log files before deletion + type: integer + default: 1024 + rotation_interval: + description: |- + If set, the interval at which log files are rotated, even if max_size is not reached. + + This is a duration and therefore can be provided with units "h", "m", "s", "ms", "us", and "ns". For example, 5 hours, 20 minutes, and 30 seconds would be `5h20m30s`. + type: string + default: 0 + max_age: + description: The maximum number of days to retain old log files. By default, there is no rotation, max_age=0. + default: 0 + type: integer collation_buffer_size: description: The size of the log collation buffer. The default is 10 if the output is stderr, or 1000 if to a file. type: integer diff --git a/docs/api/paths/admin/db-_config-audit.yaml b/docs/api/paths/admin/db-_config-audit.yaml index a6b9dc28f2..5c92096003 100644 --- a/docs/api/paths/admin/db-_config-audit.yaml +++ b/docs/api/paths/admin/db-_config-audit.yaml @@ -12,7 +12,7 @@ get: Required Sync Gateway RBAC roles: - * TODO + * Sync Gateway Architect parameters: - name: verbose in: query @@ -33,8 +33,50 @@ get: application/json: schema: oneOf: - - $ref: ../../components/schemas.yaml#/Database-audit - - $ref: ../../components/schemas.yaml#/Database-audit-verbose + - $ref: ../../components/schemas.yaml#/Database-Get-Audit + - $ref: ../../components/schemas.yaml#/Database-Get-Audit-Verbose + # example is needed DOC-12509 can't parse oneOf for examples + examples: + Simple: + value: + enabled: true + events: + audit_id1: true + audit_id2: false + disabled_users: + - domain: sgw + name: user1 + - domain: cbs + name: user2 + disabled_roles: + - domain: sgw + name: role1 + - domain: cbs + name: role2 + Verbose: + value: + enabled: true + events: + audit_id1: + name: "Audit ID 1" + description: "This is the first audit event" + enabled: true + filterable: true + audit_id2: + name: "Audit ID 2" + description: "This is the second audit event" + enabled: true + filterable: true + disabled_users: + - domain: sgw + name: user1 + - domain: cbs + name: user2 + disabled_roles: + - domain: sgw + name: role1 + - domain: cbs + name: role2 '404': $ref: ../../components/responses.yaml#/Not-found tags: @@ -47,9 +89,17 @@ put: Unspecified audit events will be reset to their default enabled value. Use POST if you want upsert-style semantics. + The body can be either: + + `{"enabled": true, {"events": {"audit_id1": true, "audit_id2": false}}}` + + or + + `{"enabled": true, {"events": {"audit_id1": {"enabled": true}, {"audit_id2": "enabled": false}}}}` + Required Sync Gateway RBAC roles: - * TODO + * Sync Gateway Architect requestBody: description: The new database audit configuration to use content: @@ -58,6 +108,22 @@ put: oneOf: - $ref: ../../components/schemas.yaml#/Database-audit - $ref: ../../components/schemas.yaml#/Database-audit-verbose + # example is needed DOC-12509 can't parse oneOf for examples + examples: + Simple: + value: + enabled: true + events: + audit_id1: true + audit_id2: false + Verbose: + value: + enabled: true + events: + audit_id1: + enabled: true + audit_id2: + enabled: false responses: '200': description: Database audit configuration successfully updated @@ -75,9 +141,18 @@ post: Unspecified audit events will be unaffected. Use PUT if you want to reset events to their default state. + The body can be either: + + `{"enabled": true, {"events": {"audit_id1": true, "audit_id2": false}}}` + + or + + `{"enabled": true, {"events": {"audit_id1": {"enabled": true}, {"audit_id2": "enabled": false}}}}` + + Required Sync Gateway RBAC roles: - * TODO + * Sync Gateway Architect parameters: - name: verbose in: query @@ -93,6 +168,28 @@ post: oneOf: - $ref: ../../components/schemas.yaml#/Database-audit - $ref: ../../components/schemas.yaml#/Database-audit-verbose + # example is needed DOC-12509 can't parse oneOf for examples + examples: + Simple: + value: + enabled: true + events: + audit_id1: true + audit_id2: false + Verbose: + value: + enabled: true + events: + audit_id1: + enabled: true + audit_id2: + enabled: false + + example: + enabled: true + events: + audit_id1: true + audit_id2: false responses: '200': description: Database audit configuration successfully updated