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

Add notifications API specs #169

Merged
merged 45 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
a1f2950
Add notifications configs API
Dec 21, 2023
c68ed62
Separate xOperationGroup for get_configs, create_config
Jan 12, 2024
032e0b6
revert openapi json
Jan 12, 2024
ae8cdab
add get notifications features API
Jan 12, 2024
980fe0b
create _plugins folder and place notifications there
Jan 12, 2024
2a75ce0
add notifications delete_config API
Jan 12, 2024
e04fb52
add multiple delete APIs for notification channels
Jan 12, 2024
dce569a
rename parameter of config_id on delete api
Jan 12, 2024
8ade51b
refactor structure
Jan 12, 2024
281fc45
add all notifications related operations
Jan 12, 2024
b49f32e
Revert "add all notifications related operations"
Jan 12, 2024
a9c0251
add all notifications related operations
Jan 12, 2024
c2b29cb
add PUT call for creating a new notification channel
Jan 12, 2024
a00a55c
add update notifications channel configuration as separate folder
Jan 12, 2024
2863919
add test feature API
Jan 12, 2024
491a033
add test feature API
Jan 12, 2024
5f46337
Add NotificationsConfigs_Delete operation
Jan 12, 2024
4e1beb9
Utilize anchor links for API references
Jan 18, 2024
50a91a7
refactor text
Jan 18, 2024
4e8e629
refactor text
Jan 18, 2024
2e697d9
Update delete notifications channel API operations naming
Jan 18, 2024
1b2f47e
change notifications versionAdded to 2.0
Jan 18, 2024
e78d0a8
change notifications versionAdded to 2.0
Jan 18, 2024
09feb68
add documentation for query params
Jan 18, 2024
3f71d33
refactor features items as enum
Jan 24, 2024
a8ed7b1
add all notification config types
Feb 2, 2024
5e4374f
add a union for notification config details
Feb 2, 2024
07c6d20
refactor
Feb 2, 2024
9fdf1cf
Update model/_plugins/notifications/config.smithy
spapadop Mar 8, 2024
c38fdd3
Add @required and @deprecated tags wherever applicable
Mar 8, 2024
487bf48
Make config_type an enum
Mar 17, 2024
056d69b
Put slack,chime,etc. at the same level as other fields in Notificatio…
Mar 17, 2024
d4699e1
Set method field as enum of ssl/start_tls,none instead of string
Mar 17, 2024
bb53f39
total_hit_relation should be an enum of eq and gte
Mar 17, 2024
b6b933f
Accept optional email_group_id_list field on Email
Mar 17, 2024
08105e5
Accept method and header_params on webhook
Mar 17, 2024
e6308b4
Reuse NotificationConfigType enum
Mar 17, 2024
189417f
Fill in NotificationsFeatureTest_Output
Mar 17, 2024
f8f0fdf
Fill in NotificationsConfigs_Delete_Output
Mar 17, 2024
9261f13
fix structure
Mar 17, 2024
3a17c5a
Fill in NotificationsConfigs_Get_Input
Mar 17, 2024
3d5f05e
Turned plugin_features field into a map
Mar 17, 2024
68e6497
rename xOperationGroup to notifications.send_test
spapadop Mar 22, 2024
796cd09
add HttpMethodSemantics.UnexpectedPayload suppress
spapadop Mar 22, 2024
84c7b51
Merge branch 'opensearch-project:main' into enhancement/notificationsapi
spapadop Mar 22, 2024
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
82 changes: 82 additions & 0 deletions model/_plugins/notifications/config.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// 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,
spapadop marked this conversation as resolved.
Show resolved Hide resolved
config: NotificationsConfigItem
Xtansia marked this conversation as resolved.
Show resolved Hide resolved
spapadop marked this conversation as resolved.
Show resolved Hide resolved
}

structure NotificationsConfigItem {
name: String,
Xtansia marked this conversation as resolved.
Show resolved Hide resolved
description: String,
config_type: String,
spapadop marked this conversation as resolved.
Show resolved Hide resolved
is_enabled: Boolean,
details: NotificationConfigDetails
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the correct schema, as the slack,sns etc. should be at the same level as config_type not within a details field.

}

union NotificationConfigDetails {
sns: SnsItem,
slack: SlackItem,
chime: Chime,
webhook: Webhook,
smtp_account: SmtpAccount,
ses_account: SesAccount,
email_group: EmailGroup,
email: Email
spapadop marked this conversation as resolved.
Show resolved Hide resolved
}

structure SlackItem {
url: String
spapadop marked this conversation as resolved.
Show resolved Hide resolved
}

structure SnsItem {
topic_arn: String,
Xtansia marked this conversation as resolved.
Show resolved Hide resolved
role_arn: String
}

structure Chime {
url: String
spapadop marked this conversation as resolved.
Show resolved Hide resolved
}

structure Webhook {
url: String
spapadop marked this conversation as resolved.
Show resolved Hide resolved
}

structure SmtpAccount {
host: String,
port: Integer,
method: String,
from_addess: String
spapadop marked this conversation as resolved.
Show resolved Hide resolved
}

structure SesAccount {
region: String,
role_arn: String,
from_addess: String
spapadop marked this conversation as resolved.
Show resolved Hide resolved
}

structure EmailGroup {
recipient_list: RecipientList,
role_arn: String,
from_addess: String
spapadop marked this conversation as resolved.
Show resolved Hide resolved
}

structure Email {
email_account_id: String,
recipient_list: RecipientList
spapadop marked this conversation as resolved.
Show resolved Hide resolved
}

list RecipientList {
member: RecipientListItem
}

structure RecipientListItem {
recipient: String
}
22 changes: 22 additions & 0 deletions model/_plugins/notifications/create_config/operations.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// 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/#create-channel-configuration"
)

@xOperationGroup("notifications.create_config")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit torn on this one. I think notifications.create_channel_config is more clear. But since this is the only kind of configs being manipulated in this plugin, it doesn't matter? 🤷 What do you think?

@xVersionAdded("2.0")
@suppress(["HttpUriConflict"])
@http(method: "POST", uri: "/_plugins/_notifications/configs")
@documentation("Create channel configuration.")
operation NotificationsConfigs_Post {
input: NotificationsConfigs_Post_Input,
output: NotificationsConfigs_Post_Output
}
20 changes: 20 additions & 0 deletions model/_plugins/notifications/create_config/structures.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// 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_Post_Input {
@required
@httpPayload
content: NotificationsConfig
}

@output
structure NotificationsConfigs_Post_Output {
config_id: String
}
34 changes: 34 additions & 0 deletions model/_plugins/notifications/delete_config/operations.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// 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/#delete-channel-configuration"
)

@xOperationGroup("notifications.delete_config")
@xVersionAdded("2.0")
@idempotent
@suppress(["HttpUriConflict"])
@http(method: "DELETE", uri: "/_plugins/_notifications/configs/{config_id}")
@documentation("Delete channel configuration.")
operation NotificationsConfigs_Delete_WithPathParams {
input: NotificationsConfigs_Delete_WithPathParams_Input,
output: NotificationsConfigs_Delete_Output
}

@xOperationGroup("notifications.delete_config")
@xVersionAdded("2.2")
@idempotent
@suppress(["HttpUriConflict"])
@http(method: "DELETE", uri: "/_plugins/_notifications/configs")
@documentation("Delete channel configuration.")
operation NotificationsConfigs_Delete_WithQueryParams {
input: NotificationsConfigs_Delete_WithQueryParams_Input,
output: NotificationsConfigs_Delete_Output
}
30 changes: 30 additions & 0 deletions model/_plugins/notifications/delete_config/structures.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// 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_Delete_WithPathParams_Input {
@required
@httpLabel
config_id: String
}

@input
structure NotificationsConfigs_Delete_WithQueryParams_Input {
@httpQuery("config_id")
@documentation("A channel ID.")
config_id: String,
nhtruong marked this conversation as resolved.
Show resolved Hide resolved

@httpQuery("config_id_list")
@documentation("A comma-separated list of channel IDs.")
config_id_list: String
}

// TODO: Fill in Output Structure (delete_response_list: object)
structure NotificationsConfigs_Delete_Output {
}
spapadop marked this conversation as resolved.
Show resolved Hide resolved
34 changes: 34 additions & 0 deletions model/_plugins/notifications/get_configs/operations.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// 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/#get-channel-configuration"
)

@xOperationGroup("notifications.get_config")
@xVersionAdded("2.0")
@readonly
@suppress(["HttpUriConflict"])
spapadop marked this conversation as resolved.
Show resolved Hide resolved
@http(method: "GET", uri: "/_plugins/_notifications/configs")
@documentation("Get channel configuration.")
operation NotificationsConfigs_Get {
input: NotificationsConfigs_Get_Input,
output: NotificationsConfigs_Get_Output
}

@xOperationGroup("notifications.get_config")
@xVersionAdded("2.0")
@readonly
@suppress(["HttpUriConflict"])
@http(method: "GET", uri: "/_plugins/_notifications/configs/{config_id}")
@documentation("Get channel configuration.")
operation NotificationsConfigsItem_Get {
input: NotificationsConfigsItem_Get_Input,
output: NotificationsConfigs_Get_Output
}
37 changes: 37 additions & 0 deletions model/_plugins/notifications/get_configs/structures.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

@input
structure NotificationsConfigs_Get_Input {
spapadop marked this conversation as resolved.
Show resolved Hide resolved
}

@input
structure NotificationsConfigsItem_Get_Input {
@required
@httpLabel
config_id: String
}

structure NotificationsConfigs_Get_Output {
start_index: Integer,
total_hits: Integer,
spapadop marked this conversation as resolved.
Show resolved Hide resolved
total_hit_relation: String,
spapadop marked this conversation as resolved.
Show resolved Hide resolved
config_list: NotificationsConfigsList
}

list NotificationsConfigsList {
member: NotificationsConfigsOutputItem
}

structure NotificationsConfigsOutputItem {
Xtansia marked this conversation as resolved.
Show resolved Hide resolved
config_id: String,
last_updated_time_ms: Integer,
created_time_ms: Integer,
spapadop marked this conversation as resolved.
Show resolved Hide resolved
config: NotificationsConfigItem
}
23 changes: 23 additions & 0 deletions model/_plugins/notifications/get_features/operations.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// 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/#list-supported-channel-configurations"
)
spapadop marked this conversation as resolved.
Show resolved Hide resolved

@xOperationGroup("notifications.features")
spapadop marked this conversation as resolved.
Show resolved Hide resolved
@xVersionAdded("2.0")
@readonly
@suppress(["HttpUriConflict"])
@http(method: "GET", uri: "/_plugins/_notifications/features")
@documentation("List supported channel configurations.")
operation NotificationsFeatures_Get {
input: NotificationsFeatures_Get_Input,
output: NotificationsFeatures_Get_Output
}
39 changes: 39 additions & 0 deletions model/_plugins/notifications/get_features/structures.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// 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 NotificationsFeatures_Get_Input {
}

@output
structure NotificationsFeatures_Get_Output {
allowed_config_type_list: NotificationsFeaturesList,
plugin_features: NotificationsPluginFeatures
spapadop marked this conversation as resolved.
Show resolved Hide resolved
}

list NotificationsFeaturesList {
member: NotificationsFeaturesListItem
}

@documentation("Limit the information for notifications features list.")
enum NotificationsFeaturesListItem {
SLACK = "slack",
CHIME = "chime",
MICROSOFT_TEAMS = "microsoft_teams",
WEBHOOK = "webhook",
EMAIL = "email",
SNS = "sns",
SES_ACCOUNT = "ses_account",
SMTP_ACCOUNT = "smtp_account",
EMAIL_GROUP = "email_group"
}
spapadop marked this conversation as resolved.
Show resolved Hide resolved

structure NotificationsPluginFeatures {
tooltip_support: Boolean
}
34 changes: 34 additions & 0 deletions model/_plugins/notifications/test_feature/operations.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// 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/#send-test-notification"
)
spapadop marked this conversation as resolved.
Show resolved Hide resolved

@xOperationGroup("notifications.feature.test")
spapadop marked this conversation as resolved.
Show resolved Hide resolved
spapadop marked this conversation as resolved.
Show resolved Hide resolved
@xVersionAdded("2.0")
@readonly
@suppress(["HttpUriConflict"])
@http(method: "GET", uri: "/_plugins/_notifications/feature/test/{config_id}")
spapadop marked this conversation as resolved.
Show resolved Hide resolved
@documentation("Send a test notification.")
operation NotificationsFeatureTest_Get {
input: NotificationsFeatureTest_Input,
output: NotificationsFeatureTest_Output
}

@xOperationGroup("notifications.feature.test")
@xVersionAdded("2.0")
@readonly
@suppress(["HttpUriConflict"])
@http(method: "POST", uri: "/_plugins/_notifications/feature/test/{config_id}")
@documentation("Send a test notification.")
operation NotificationsFeatureTest_Post {
input: NotificationsFeatureTest_Input,
output: NotificationsFeatureTest_Output
}
18 changes: 18 additions & 0 deletions model/_plugins/notifications/test_feature/structures.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// 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 NotificationsFeatureTest_Input {
@required
@httpLabel
config_id: String
}

// TODO: Fill in Output Structure
structure NotificationsFeatureTest_Output {
}
spapadop marked this conversation as resolved.
Show resolved Hide resolved
spapadop marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading