From 7cf6a6977b99ce47f134fd821e0f326996d786a3 Mon Sep 17 00:00:00 2001 From: Sokratis Papadopoulos Date: Thu, 21 Dec 2023 13:03:25 +0200 Subject: [PATCH] Add notifications configs API --- model/notifications/config.smithy | 37 +++++++++++++++++++ model/notifications/configs/operations.smithy | 33 +++++++++++++++++ model/notifications/configs/structures.smithy | 32 ++++++++++++++++ model/opensearch.smithy | 2 + 4 files changed, 104 insertions(+) create mode 100644 model/notifications/config.smithy create mode 100644 model/notifications/configs/operations.smithy create mode 100644 model/notifications/configs/structures.smithy diff --git a/model/notifications/config.smithy b/model/notifications/config.smithy new file mode 100644 index 000000000..42dbdc99d --- /dev/null +++ b/model/notifications/config.smithy @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// The OpenSearch Contributors require contributions made to +// this file be licensed under the Apache-2.0 license or a +// compatible open source license. + +$version: "2" +namespace OpenSearch + +structure NotificationsConfig { + config_id: String, + name: String, + config: NotificationsConfigItem +} + +structure NotificationsConfigItem { + name: String, + description: String, + config_type: String, + is_enabled: Boolean, + slack: SlackItem +} + +structure SlackItem { + url: String +} + +structure NotificationsConfigsOutputItem { + config_id: String, + last_updated_time_ms: Integer, + created_time_ms: Integer, + config: NotificationsConfigItem +} + +list NotificationsConfigsList { + member: NotificationsConfigsOutputItem +} diff --git a/model/notifications/configs/operations.smithy b/model/notifications/configs/operations.smithy new file mode 100644 index 000000000..5afc6385c --- /dev/null +++ b/model/notifications/configs/operations.smithy @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// The OpenSearch Contributors require contributions made to +// this file be licensed under the Apache-2.0 license or a +// compatible open source license. + +$version: "2" +namespace OpenSearch + +@externalDocumentation( + "API Reference": "https://opensearch.org/docs/latest/observing-your-data/notifications/api/" +) + +@xOperationGroup("notifications.configs") +@xVersionAdded("2.2") +@readonly +@suppress(["HttpUriConflict"]) +@http(method: "GET", uri: "/_plugins/_notifications/configs") +@documentation("Retrieves all notification configurations.") +operation NotificationsConfigs_Get { + input: NotificationsConfigs_Get_Input, + output: NotificationsConfigs_Get_Output +} + +@xOperationGroup("notifications.configs") +@xVersionAdded("2.2") +@suppress(["HttpUriConflict"]) +@http(method: "POST", uri: "/_plugins/_notifications/configs") +@documentation("Creates a notification channel configuration.") +operation NotificationsConfigs_Post { + input: NotificationsConfigs_Post_Input, + output: NotificationsConfigs_Post_Output +} diff --git a/model/notifications/configs/structures.smithy b/model/notifications/configs/structures.smithy new file mode 100644 index 000000000..be0653c21 --- /dev/null +++ b/model/notifications/configs/structures.smithy @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// The OpenSearch Contributors require contributions made to +// this file be licensed under the Apache-2.0 license or a +// compatible open source license. + +$version: "2" +namespace OpenSearch + +@input +structure NotificationsConfigs_Get_Input { +} + +@output +structure NotificationsConfigs_Get_Output { + start_index: Integer, + total_hits: Integer, + total_hit_relation: String, + config_list: NotificationsConfigsList +} + +@input +structure NotificationsConfigs_Post_Input { + @required + @httpPayload + content: NotificationsConfig +} + +@output +structure NotificationsConfigs_Post_Output { + config_id: String +} diff --git a/model/opensearch.smithy b/model/opensearch.smithy index ccb6b3805..c3b02b53d 100644 --- a/model/opensearch.smithy +++ b/model/opensearch.smithy @@ -295,6 +295,8 @@ service OpenSearch { NodesUsage_WithMetric, NodesUsage_WithMetricNodeId, NodesUsage_WithNodeId, + NotificationsConfigs_Get, + NotificationsConfigs_Post, PatchActionGroup, PatchActionGroups, PatchAuditConfiguration,