Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SnapshotManagement namespace api #701

Merged
merged 10 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added API spec for `adjust_pure_negative` for bool queries ([#641](https://github.com/opensearch-project/opensearch-api-specification/pull/641))
- Added a spec style checker [#620](https://github.com/opensearch-project/opensearch-api-specification/pull/620).
- Added `remote_store` to node `Stats` ([#643](https://github.com/opensearch-project/opensearch-api-specification/pull/643))
- Added `sm` namespace API specifications ([#701](https://github.com/opensearch-project/opensearch-api-specification/pull/701))

### Changed

Expand Down
234 changes: 234 additions & 0 deletions spec/namespaces/snapshot_management.yaml
Original file line number Diff line number Diff line change
@@ -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
147 changes: 147 additions & 0 deletions spec/schemas/snapshot_management._common.yaml
Original file line number Diff line number Diff line change
@@ -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
Loading