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 42 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
133 changes: 133 additions & 0 deletions model/_plugins/notifications/config.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
// 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,
@required
config: NotificationsConfigItem
Xtansia marked this conversation as resolved.
Show resolved Hide resolved
spapadop marked this conversation as resolved.
Show resolved Hide resolved
}

@documentation("Type of notification configuration.")
enum NotificationConfigType {
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"
}

structure NotificationsConfigItem {
@required
name: String,
Xtansia marked this conversation as resolved.
Show resolved Hide resolved
description: String
@required
config_type: NotificationConfigType,
is_enabled: Boolean,
sns: SnsItem,
slack: SlackItem,
chime: Chime,
webhook: Webhook,
smtp_account: SmtpAccount,
ses_account: SesAccount,
email_group: EmailGroup,
email: Email,
microsoft_teams: MicrosoftTeamsItem
}

structure MicrosoftTeamsItem {
@required
url: String
}

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

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

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

enum HttpMethodType {
POST = "POST",
PUT = "PUT",
PATCH = "PATCH"
}

map HeaderParamsMap {
key: String
value: Integer
}

structure Webhook {
@required
url: String,
method: HttpMethodType,
header_params: HeaderParamsMap,
}

enum EmailEncryptionMethod {
SSL = "ssl",
START_TLS = "start_tls",
NONE = "none"
}

structure SmtpAccount {
@required
host: String,
@required
port: Integer,
@required
method: EmailEncryptionMethod,
@required
from_addess: String
}

structure SesAccount {
@required
region: String,
role_arn: String,
@required
from_addess: String
}

list EmailGroupIdList {
member: String
}

list RecipientList {
member: RecipientListItem
}

structure RecipientListItem {
recipient: String
}

structure EmailGroup {
@required
recipient_list: RecipientList,
email_group_id_list: EmailGroupIdList
}

structure Email {
@required
email_account_id: String,
recipient_list: RecipientList
}
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
}
55 changes: 55 additions & 0 deletions model/_plugins/notifications/delete_config/structures.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// 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
}

structure NotificationsConfigs_Delete_Output {
delete_response_list: DeleteResponseList
}

map DeleteResponseList {
key: String
value: RestStatus
}

enum RestStatus {
CONTINUE = "continue",
SWITCHING_PROTOCOLS = "switching_protocols",
OK = "ok",
CREATED = "created",
ACCEPTED = "accepted",
NON_AUTHORITATIVE_INFORMATION = "non_authoritative_information",
NO_CONTENT = "no_content",
RESET_CONTENT = "reset_content",
PARTIAL_CONTENT = "partial_content",
MULTI_STATUS = "multi_status",
MULTIPLE_CHOICES = "multiple_choices",
MOVED_PERMANENTLY = "moved_permanently",
FOUND = "found",
SEE_OTHER = "see_other",
NOT_MODIFIED = "not_modified",
USE_PROXY = "use_proxy",
TEMPORARY_REDIRECT = "temporary_redirect"
}
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
}
Loading
Loading