Skip to content

Commit

Permalink
Add notifications configs API
Browse files Browse the repository at this point in the history
  • Loading branch information
Sokratis Papadopoulos committed Dec 21, 2023
1 parent b42000c commit 7cf6a69
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 0 deletions.
37 changes: 37 additions & 0 deletions model/notifications/config.smithy
Original file line number Diff line number Diff line change
@@ -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
}
33 changes: 33 additions & 0 deletions model/notifications/configs/operations.smithy
Original file line number Diff line number Diff line change
@@ -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
}
32 changes: 32 additions & 0 deletions model/notifications/configs/structures.smithy
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 2 additions & 0 deletions model/opensearch.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ service OpenSearch {
NodesUsage_WithMetric,
NodesUsage_WithMetricNodeId,
NodesUsage_WithNodeId,
NotificationsConfigs_Get,
NotificationsConfigs_Post,
PatchActionGroup,
PatchActionGroups,
PatchAuditConfiguration,
Expand Down

0 comments on commit 7cf6a69

Please sign in to comment.