From 92fbd03ae8b7b83790fbc49bacc4b17bd34bdfaa Mon Sep 17 00:00:00 2001 From: alen_abeshov Date: Sat, 30 Nov 2024 15:37:03 +0500 Subject: [PATCH] Fixing errors while linting Signed-off-by: alen_abeshov --- spec/namespaces/snapshot_management.yaml | 234 +++++++++++ spec/namespaces/snapshot_managment.yaml | 258 ------------ spec/schemas/snapshot_management._common.yaml | 147 +++++++ spec/schemas/snapshot_managment.__common.yaml | 397 ------------------ 4 files changed, 381 insertions(+), 655 deletions(-) create mode 100644 spec/namespaces/snapshot_management.yaml delete mode 100644 spec/namespaces/snapshot_managment.yaml create mode 100644 spec/schemas/snapshot_management._common.yaml delete mode 100644 spec/schemas/snapshot_managment.__common.yaml diff --git a/spec/namespaces/snapshot_management.yaml b/spec/namespaces/snapshot_management.yaml new file mode 100644 index 000000000..22e50fc37 --- /dev/null +++ b/spec/namespaces/snapshot_management.yaml @@ -0,0 +1,234 @@ +openapi: 3.1.0 +info: + title: OpenSearch Snapshot Management API + description: API for automating snapshot management tasks. + version: 1.0.0 +paths: + /_plugins/_sm/policies: + get: + operationId: snapshot_management.get_policies.0 + x-operation-group: snapshot_management.get_policies + x-version-added: '2.1' + description: Retrieves all snapshot management policies. + responses: + '200': + $ref: '#/components/responses/snapshot_management.get_policies@200' + post: + operationId: snapshot_management.create_policy.0 + x-operation-group: snapshot_management.create_policy + x-version-added: '2.1' + description: Creates a new snapshot management policy. + requestBody: + $ref: '#/components/requestBodies/snapshot_management.create_policy' + responses: + '200': + $ref: '#/components/responses/snapshot_management.create_policy@200' + /_plugins/_sm/policies/{policy_name}: + get: + operationId: snapshot_management.get_policy.0 + x-operation-group: snapshot_management.get_policy + x-version-added: '2.1' + description: Retrieves a specific snapshot management policy by name. + parameters: + - $ref: '#/components/parameters/snapshot_management.get_policy::path.policy_name' + responses: + '200': + $ref: '#/components/responses/snapshot_management.get_policy@200' + '404': + $ref: '#/components/responses/snapshot_management.get_policy@404' + put: + operationId: snapshot_management.update_policy.0 + x-operation-group: snapshot_management.update_policy + x-version-added: '2.1' + description: Updates an existing snapshot management policy. + parameters: + - $ref: '#/components/parameters/snapshot_management.update_policy::path.policy_name' + requestBody: + $ref: '#/components/requestBodies/snapshot_management.update_policy' + responses: + '200': + $ref: '#/components/responses/snapshot_management.update_policy@200' + '404': + $ref: '#/components/responses/snapshot_management.update_policy@404' + delete: + operationId: snapshot_management.delete_policy.0 + x-operation-group: snapshot_management.delete_policy + x-version-added: '2.1' + description: Deletes a snapshot management policy. + parameters: + - $ref: '#/components/parameters/snapshot_management.delete_policy::path.policy_name' + responses: + '200': + $ref: '#/components/responses/snapshot_management.delete_policy@200' + '404': + $ref: '#/components/responses/snapshot_management.delete_policy@404' + /_plugins/_sm/policies/{policy_name}/_explain: + get: + operationId: snapshot_management.explain_policy.0 + x-operation-group: snapshot_management.explain_policy + x-version-added: '2.1' + description: Explains the state of the snapshot management policy. + parameters: + - $ref: '#/components/parameters/snapshot_management.explain_policy::path.policy_name' + responses: + '200': + $ref: '#/components/responses/snapshot_management.explain_policy@200' + /_plugins/_sm/policies/{policy_name}/_start: + post: + operationId: snapshot_management.start_policy.0 + x-operation-group: snapshot_management.start_policy + x-version-added: '2.1' + description: Starts a snapshot management policy. + parameters: + - $ref: '#/components/parameters/snapshot_management.start_policy::path.policy_name' + responses: + '200': + $ref: '#/components/responses/snapshot_management.start_policy@200' + /_plugins/_sm/policies/{policy_name}/_stop: + post: + operationId: snapshot_management.stop_policy.0 + x-operation-group: snapshot_management.stop_policy + x-version-added: '2.1' + description: Stops a snapshot management policy. + parameters: + - $ref: '#/components/parameters/snapshot_management.stop_policy::path.policy_name' + responses: + '200': + $ref: '#/components/responses/snapshot_management.stop_policy@200' +components: + requestBodies: + snapshot_management.create_policy: + content: + application/json: + schema: + $ref: '../schemas/snapshot_management._common.yaml#/components/schemas/SnapshotPolicy' + snapshot_management.update_policy: + content: + application/json: + schema: + $ref: '../schemas/snapshot_management._common.yaml#/components/schemas/SnapshotPolicy' + responses: + snapshot_management.get_policies@200: + description: Successfully retrieved the list of snapshot management policies. + content: + application/json: + schema: + $ref: '../schemas/snapshot_management._common.yaml#/components/schemas/PolicyList' + snapshot_management.create_policy@200: + description: Successfully created the snapshot management policy. + content: + application/json: + schema: + type: object + properties: + policy_name: + type: string + snapshot_management.get_policy@200: + description: Successfully retrieved the snapshot management policy. + content: + application/json: + schema: + $ref: '../schemas/snapshot_management._common.yaml#/components/schemas/SnapshotPolicy' + snapshot_management.get_policy@404: + description: Snapshot management policy not found. + content: + application/json: + schema: + $ref: '../schemas/snapshot_management._common.yaml#/components/schemas/NotFoundResponse' + snapshot_management.update_policy@200: + description: Successfully updated the snapshot management policy. + content: + application/json: + schema: + type: object + properties: + policy_name: + type: string + snapshot_management.update_policy@404: + description: Snapshot management policy not found. + content: + application/json: + schema: + $ref: '../schemas/snapshot_management._common.yaml#/components/schemas/NotFoundResponse' + snapshot_management.delete_policy@200: + description: Successfully deleted the snapshot management policy. + content: + application/json: + schema: + type: object + properties: + result: + type: string + snapshot_management.delete_policy@404: + description: Snapshot management policy not found. + content: + application/json: + schema: + $ref: '../schemas/snapshot_management._common.yaml#/components/schemas/NotFoundResponse' + snapshot_management.explain_policy@200: + description: Successfully explained the state of the snapshot management policy. + content: + application/json: + schema: + $ref: '../schemas/snapshot_management._common.yaml#/components/schemas/PolicyExplanation' + snapshot_management.start_policy@200: + description: Successfully started the snapshot management policy. + content: + application/json: + schema: + type: object + properties: + acknowledged: + type: boolean + snapshot_management.stop_policy@200: + description: Successfully stopped the snapshot management policy. + content: + application/json: + schema: + type: object + properties: + acknowledged: + type: boolean + parameters: + snapshot_management.get_policy::path.policy_name: + in: path + name: policy_name + description: The name of the snapshot management policy. + required: true + schema: + type: string + snapshot_management.update_policy::path.policy_name: + in: path + name: policy_name + description: The name of the snapshot management policy to update. + required: true + schema: + type: string + snapshot_management.delete_policy::path.policy_name: + in: path + name: policy_name + description: The name of the snapshot management policy to delete. + required: true + schema: + type: string + snapshot_management.explain_policy::path.policy_name: + in: path + name: policy_name + description: The name of the snapshot management policy to explain. + required: true + schema: + type: string + snapshot_management.start_policy::path.policy_name: + in: path + name: policy_name + description: The name of the snapshot management policy to start. + required: true + schema: + type: string + snapshot_management.stop_policy::path.policy_name: + in: path + name: policy_name + description: The name of the snapshot management policy to stop. + required: true + schema: + type: string diff --git a/spec/namespaces/snapshot_managment.yaml b/spec/namespaces/snapshot_managment.yaml deleted file mode 100644 index 88d7a870d..000000000 --- a/spec/namespaces/snapshot_managment.yaml +++ /dev/null @@ -1,258 +0,0 @@ -openapi: 3.1.0 -info: - title: OpenSearch Snapshot Management API - description: API for managing Snapshot Management policies and operations. - version: 1.0.0 -paths: - /_plugins/_sm/policies: - get: - operationId: sm.list_policies.0 - x-operation-group: sm.list_policies - x-version-added: '2.1' - description: Retrieves a list of all SM policies. - parameters: - - $ref: '#/components/parameters/sm.list_policies::query.from' - - $ref: '#/components/parameters/sm.list_policies::query.size' - - $ref: '#/components/parameters/sm.list_policies::query.sortField' - - $ref: '#/components/parameters/sm.list_policies::query.sortOrder' - - $ref: '#/components/parameters/sm.list_policies::query.queryString' - responses: - '200': - $ref: '#/components/responses/sm.list_policies@200' - post: - operationId: sm.create_policy.0 - x-operation-group: sm.create_policy - x-version-added: '2.1' - description: Creates a new SM policy. - requestBody: - $ref: '#/components/requestBodies/sm.create_policy' - responses: - '200': - $ref: '#/components/responses/sm.create_policy@200' - /_plugins/_sm/policies/{policy_name}: - get: - operationId: sm.get_policy.0 - x-operation-group: sm.get_policy - x-version-added: '2.1' - description: Retrieves a specific SM policy by name. - parameters: - - $ref: '#/components/parameters/sm.policy_name' - responses: - '200': - $ref: '#/components/responses/sm.get_policy@200' - '404': - $ref: '#/components/responses/sm.policy_not_found@404' - put: - operationId: sm.update_policy.0 - x-operation-group: sm.update_policy - x-version-added: '2.1' - description: Updates an existing SM policy. - parameters: - - $ref: '#/components/parameters/sm.policy_name' - - $ref: '#/components/parameters/sm.update_policy::query.if_seq_no' - - $ref: '#/components/parameters/sm.update_policy::query.if_primary_term' - requestBody: - $ref: '#/components/requestBodies/sm.update_policy' - responses: - '200': - $ref: '#/components/responses/sm.update_policy@200' - '404': - $ref: '#/components/responses/sm.policy_not_found@404' - post: - operationId: sm.create_or_update_policy.0 - x-operation-group: sm.create_or_update_policy - x-version-added: '2.1' - description: Creates or updates an SM policy. - parameters: - - $ref: '#/components/parameters/sm.policy_name' - requestBody: - $ref: '#/components/requestBodies/sm.create_policy' - responses: - '200': - $ref: '#/components/responses/sm.create_policy@200' - delete: - operationId: sm.delete_policy.0 - x-operation-group: sm.delete_policy - x-version-added: '2.1' - description: Deletes an SM policy by name. - parameters: - - $ref: '#/components/parameters/sm.policy_name' - responses: - '200': - $ref: '#/components/responses/sm.delete_policy@200' - '404': - $ref: '#/components/responses/sm.policy_not_found@404' - /_plugins/_sm/policies/{policy_name}/_explain: - get: - operationId: sm.explain_policy.0 - x-operation-group: sm.explain_policy - x-version-added: '2.1' - description: Provides status and metadata for specified SM policies. - parameters: - - $ref: '#/components/parameters/sm.policy_name' - responses: - '200': - $ref: '#/components/responses/sm.explain_policy@200' - '404': - $ref: '#/components/responses/sm.policy_not_found@404' - /_plugins/_sm/policies/{policy_name}/_start: - post: - operationId: sm.start_policy.0 - x-operation-group: sm.start_policy - x-version-added: '2.1' - description: Starts an SM policy by setting its enabled flag to true. - parameters: - - $ref: '#/components/parameters/sm.policy_name' - responses: - '200': - $ref: '#/components/responses/sm.start_policy@200' - '404': - $ref: '#/components/responses/sm.policy_not_found@404' - /_plugins/_sm/policies/{policy_name}/_stop: - post: - operationId: sm.stop_policy.0 - x-operation-group: sm.stop_policy - x-version-added: '2.1' - description: Stops an SM policy by setting its enabled flag to false. - parameters: - - $ref: '#/components/parameters/sm.policy_name' - responses: - '200': - $ref: '#/components/responses/sm.stop_policy@200' - '404': - $ref: '#/components/responses/sm.policy_not_found@404' -components: - requestBodies: - sm.create_policy: - content: - application/json: - schema: - $ref: '../schemas/sm._common.yaml#/components/schemas/SnapshotManagementPolicy' - sm.update_policy: - content: - application/json: - schema: - $ref: '../schemas/sm._common.yaml#/components/schemas/SnapshotManagementPolicy' - responses: - sm.list_policies@200: - description: Successful response containing the list of SM policies. - content: - application/json: - schema: - $ref: '../schemas/sm._common.yaml#/components/schemas/SnapshotManagementPolicyList' - sm.create_policy@200: - description: Policy created successfully. - content: - application/json: - schema: - $ref: '../schemas/sm._common.yaml#/components/schemas/CreatePolicyResponse' - sm.get_policy@200: - description: Successful response containing the SM policy details. - content: - application/json: - schema: - $ref: '../schemas/sm._common.yaml#/components/schemas/GetPolicyResponse' - sm.update_policy@200: - description: Policy updated successfully. - content: - application/json: - schema: - $ref: '../schemas/sm._common.yaml#/components/schemas/UpdatePolicyResponse' - sm.delete_policy@200: - description: Policy deleted successfully. - content: - application/json: - schema: - $ref: '../schemas/sm._common.yaml#/components/schemas/DeletePolicyResponse' - sm.explain_policy@200: - description: Successful response containing policy explanations. - content: - application/json: - schema: - $ref: '../schemas/sm._common.yaml#/components/schemas/ExplainPolicyResponse' - sm.start_policy@200: - description: Policy started successfully. - content: - application/json: - schema: - $ref: '../schemas/sm._common.yaml#/components/schemas/StartStopPolicyResponse' - sm.stop_policy@200: - description: Policy stopped successfully. - content: - application/json: - schema: - $ref: '../schemas/sm._common.yaml#/components/schemas/StartStopPolicyResponse' - sm.policy_not_found@404: - description: Policy not found. - content: - application/json: - schema: - $ref: '../schemas/sm._common.yaml#/components/schemas/NotFoundResponse' - parameters: - sm.policy_name: - in: path - name: policy_name - description: The name of the SM policy. - required: true - schema: - type: string - style: simple - sm.update_policy::query.if_seq_no: - in: query - name: if_seq_no - description: Sequence number for optimistic concurrency control. - required: true - schema: - type: integer - style: form - sm.update_policy::query.if_primary_term: - in: query - name: if_primary_term - description: Primary term for optimistic concurrency control. - required: true - schema: - type: integer - style: form - sm.list_policies::query.from: - in: query - name: from - description: Starting index for pagination. - required: false - schema: - type: integer - default: 0 - sm.list_policies::query.size: - in: query - name: size - description: Number of policies to return. - required: false - schema: - type: integer - default: 20 - sm.list_policies::query.sortField: - in: query - name: sortField - description: Field to sort by. - required: false - schema: - type: string - default: sm_policy.name - sm.list_policies::query.sortOrder: - in: query - name: sortOrder - description: Sort order (asc or desc). - required: false - schema: - type: string - enum: - - asc - - desc - default: asc - sm.list_policies::query.queryString: - in: query - name: queryString - description: Query string for searching policies. - required: false - schema: - type: string - default: '*' diff --git a/spec/schemas/snapshot_management._common.yaml b/spec/schemas/snapshot_management._common.yaml new file mode 100644 index 000000000..982ead3d5 --- /dev/null +++ b/spec/schemas/snapshot_management._common.yaml @@ -0,0 +1,147 @@ +openapi: 3.1.0 +info: + title: Schemas for OpenSearch Snapshot Management API + description: Common schemas for Snapshot Management API + version: 1.0.0 +paths: {} +components: + schemas: + PolicyList: + type: object + properties: + totalPolicies: + type: integer + policies: + type: array + items: + $ref: '#/components/schemas/SnapshotPolicy' + + SnapshotPolicy: + type: object + properties: + name: + type: string + description: + type: string + creation: + $ref: '#/components/schemas/CreationConfig' + deletion: + $ref: '#/components/schemas/DeletionConfig' + snapshot_config: + $ref: '#/components/schemas/SnapshotConfig' + notification: + $ref: '#/components/schemas/NotificationConfig' + required: + - creation + - name + - snapshot_config + + CreationConfig: + type: object + properties: + schedule: + type: string + time_limit: + type: string + + DeletionConfig: + type: object + properties: + schedule: + type: string + condition: + $ref: '#/components/schemas/DeletionCondition' + time_limit: + type: string + + DeletionCondition: + type: object + properties: + max_age: + type: string + max_count: + type: integer + min_count: + type: integer + + SnapshotConfig: + type: object + properties: + indices: + type: string + repository: + type: string + ignore_unavailable: + type: boolean + include_global_state: + type: boolean + date_format: + type: string + timezone: + type: string + + NotificationConfig: + type: object + properties: + channel: + $ref: '#/components/schemas/NotificationChannel' + conditions: + $ref: '#/components/schemas/NotificationConditions' + + NotificationChannel: + type: object + properties: + id: + type: string + + NotificationConditions: + type: object + properties: + creation: + type: boolean + deletion: + type: boolean + failure: + type: boolean + time_limit_exceeded: + type: boolean + + PolicyExplanation: + type: object + properties: + policies: + type: array + items: + $ref: '#/components/schemas/PolicyState' + + PolicyState: + type: object + properties: + name: + type: string + creation: + $ref: '#/components/schemas/StateMetadata' + deletion: + $ref: '#/components/schemas/StateMetadata' + + StateMetadata: + type: object + properties: + current_state: + type: string + trigger: + $ref: '#/components/schemas/TriggerMetadata' + + TriggerMetadata: + type: object + properties: + time: + type: integer + + NotFoundResponse: + type: object + properties: + error: + type: string + status: + type: integer diff --git a/spec/schemas/snapshot_managment.__common.yaml b/spec/schemas/snapshot_managment.__common.yaml deleted file mode 100644 index 66cf7b27b..000000000 --- a/spec/schemas/snapshot_managment.__common.yaml +++ /dev/null @@ -1,397 +0,0 @@ -openapi: 3.1.0 -info: - title: Schemas for OpenSearch Snapshot Management API - description: Schemas for OpenSearch Snapshot Management API - version: 1.0.0 -paths: {} -components: - schemas: - SnapshotManagementPolicyList: - type: object - properties: - policies: - type: array - items: - $ref: '#/components/schemas/GetPolicyResponse' - total_policies: - type: integer - required: - - policies - - total_policies - - SnapshotManagementPolicy: - type: object - properties: - description: - type: string - enabled: - type: boolean - snapshot_config: - $ref: '#/components/schemas/SnapshotConfig' - creation: - $ref: '#/components/schemas/CreationConfig' - deletion: - $ref: '#/components/schemas/DeletionConfig' - notification: - $ref: '#/components/schemas/NotificationConfig' - required: - - creation - - snapshot_config - - SnapshotConfig: - type: object - properties: - date_format: - type: string - default: "yyyy-MM-dd'T'HH:mm:ss" - timezone: - type: string - default: UTC - indices: - type: string - default: '*' - repository: - type: string - ignore_unavailable: - type: boolean - default: false - include_global_state: - type: boolean - default: true - partial: - type: boolean - default: false - metadata: - type: object - additionalProperties: - type: string - required: - - repository - - CreationConfig: - type: object - properties: - schedule: - $ref: '#/components/schemas/Schedule' - time_limit: - type: string - required: - - schedule - - DeletionConfig: - type: object - properties: - schedule: - $ref: '#/components/schemas/Schedule' - time_limit: - type: string - condition: - $ref: '#/components/schemas/DeleteCondition' - required: - - condition - - Schedule: - type: object - properties: - cron: - $ref: '#/components/schemas/CronSchedule' - interval: - $ref: '#/components/schemas/IntervalSchedule' - - CronSchedule: - type: object - properties: - expression: - type: string - timezone: - type: string - required: - - expression - - IntervalSchedule: - type: object - properties: - start_time: - type: integer - period: - type: integer - unit: - type: string - enum: - - Days - - Hours - - Minutes - required: - - period - - start_time - - unit - - DeleteCondition: - type: object - properties: - max_count: - type: integer - min_count: - type: integer - default: 1 - max_age: - type: string - - NotificationConfig: - type: object - properties: - channel: - $ref: '#/components/schemas/NotificationChannel' - conditions: - $ref: '#/components/schemas/NotificationConditions' - - NotificationChannel: - type: object - properties: - id: - type: string - required: - - id - - NotificationConditions: - type: object - properties: - creation: - type: boolean - default: true - deletion: - type: boolean - default: false - failure: - type: boolean - default: false - time_limit_exceeded: - type: boolean - default: false - - GetPolicyResponse: - type: object - properties: - _id: - type: string - _version: - type: integer - _seq_no: - type: integer - _primary_term: - type: integer - sm_policy: - $ref: '#/components/schemas/SnapshotManagementPolicy' - required: - - _id - - _primary_term - - _seq_no - - _version - - sm_policy - - CreatePolicyResponse: - type: object - properties: - _id: - type: string - _version: - type: integer - _seq_no: - type: integer - _primary_term: - type: integer - required: - - _id - - _primary_term - - _seq_no - - _version - - UpdatePolicyResponse: - type: object - properties: - _id: - type: string - _version: - type: integer - _seq_no: - type: integer - _primary_term: - type: integer - required: - - _id - - _primary_term - - _seq_no - - _version - - DeletePolicyResponse: - type: object - properties: - _index: - type: string - _id: - type: string - _version: - type: integer - result: - type: string - enum: - - deleted - forced_refresh: - type: boolean - _shards: - $ref: '#/components/schemas/ShardsInfo' - _seq_no: - type: integer - _primary_term: - type: integer - required: - - _id - - _index - - _primary_term - - _seq_no - - _shards - - _version - - forced_refresh - - result - - ShardsInfo: - type: object - properties: - total: - type: integer - successful: - type: integer - failed: - type: integer - required: - - failed - - successful - - total - - ExplainPolicyResponse: - type: object - properties: - policies: - type: array - items: - $ref: '#/components/schemas/PolicyExplain' - required: - - policies - - PolicyExplain: - type: object - properties: - name: - type: string - creation: - $ref: '#/components/schemas/PolicyMetadata' - deletion: - $ref: '#/components/schemas/PolicyMetadata' - policy_seq_no: - type: integer - policy_primary_term: - type: integer - enabled: - type: boolean - required: - - enabled - - name - - policy_primary_term - - policy_seq_no - - PolicyMetadata: - type: object - properties: - current_state: - type: string - trigger: - $ref: '#/components/schemas/Trigger' - latest_execution: - $ref: '#/components/schemas/LatestExecution' - retry: - $ref: '#/components/schemas/RetryInfo' - - Trigger: - type: object - properties: - time: - type: integer - - LatestExecution: - type: object - properties: - status: - type: string - enum: - - FAILED - - IN_PROGRESS - - RETRYING - - SUCCESS - - TIME_LIMIT_EXCEEDED - start_time: - type: integer - end_time: - type: integer - info: - $ref: '#/components/schemas/ExecutionInfo' - - ExecutionInfo: - type: object - properties: - message: - type: string - cause: - type: string - - RetryInfo: - type: object - properties: - count: - type: integer - - StartStopPolicyResponse: - type: object - properties: - acknowledged: - type: boolean - required: - - acknowledged - - NotFoundResponse: - type: object - properties: - error: - $ref: '#/components/schemas/ErrorResponse' - status: - type: integer - example: 404 - required: - - error - - status - - ErrorResponse: - type: object - properties: - root_cause: - type: array - items: - $ref: '#/components/schemas/RootCause' - type: - type: string - reason: - type: string - required: - - reason - - root_cause - - type - - RootCause: - type: object - properties: - type: - type: string - reason: - type: string - required: - - reason - - type