Skip to content

Commit

Permalink
Add notifications API specs (#169)
Browse files Browse the repository at this point in the history
* Add notifications configs API

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* Separate xOperationGroup for get_configs, create_config

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* revert openapi json

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* add get notifications features API

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* create _plugins folder and place notifications there

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* add notifications delete_config API

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* add multiple delete APIs for notification channels

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* rename parameter of config_id on delete api

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* refactor structure

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* add all notifications related operations

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* Revert "add all notifications related operations"

This reverts commit b4c3f11.

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* add all notifications related operations

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* add PUT call for creating a new notification channel

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* add update notifications channel configuration as separate folder

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* add test feature API

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* add test feature API

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* Add NotificationsConfigs_Delete operation

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* Utilize anchor links for API references

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* refactor text

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* refactor text

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* Update delete notifications channel API operations naming

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* change notifications versionAdded to 2.0

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* change notifications versionAdded to 2.0

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* add documentation for query params

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* refactor features items as enum

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* add all notification config types

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* add a union for notification config details

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* refactor

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* Update model/_plugins/notifications/config.smithy

remove name field from NotificationsConfig

Co-authored-by: Thomas Farr <[email protected]>
Signed-off-by: Sokratis Papadopoulos <[email protected]>

* Add @required and @deprecated tags wherever applicable

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* Make config_type an enum

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* Put slack,chime,etc. at the same level as other fields in NotificationConfigType

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* Set method field as enum of ssl/start_tls,none instead of string

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* total_hit_relation should be an enum of eq and gte

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* Accept optional email_group_id_list field on Email

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* Accept method and header_params on webhook

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* Reuse NotificationConfigType enum

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* Fill in NotificationsFeatureTest_Output

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* Fill in NotificationsConfigs_Delete_Output

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* fix structure

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* Fill in NotificationsConfigs_Get_Input

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* Turned plugin_features field into a map

Signed-off-by: Sokratis Papadopoulos <[email protected]>

* rename xOperationGroup to notifications.send_test

Co-authored-by: Thomas Farr <[email protected]>
Signed-off-by: Sokratis Papadopoulos <[email protected]>

* add HttpMethodSemantics.UnexpectedPayload suppress

Co-authored-by: Thomas Farr <[email protected]>
Signed-off-by: Sokratis Papadopoulos <[email protected]>

---------

Signed-off-by: Sokratis Papadopoulos <[email protected]>
Signed-off-by: Sokratis Papadopoulos <[email protected]>
Co-authored-by: Sokratis Papadopoulos <[email protected]>
Co-authored-by: Thomas Farr <[email protected]>
  • Loading branch information
3 people authored Mar 24, 2024
1 parent 3763fdd commit a44e6d9
Show file tree
Hide file tree
Showing 14 changed files with 668 additions and 0 deletions.
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
}

@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,
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
}

structure SnsItem {
@required
topic_arn: String,
role_arn: String
}

structure Chime {
@required
url: String
}

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")
@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,

@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"
}
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", "HttpMethodSemantics.UnexpectedPayload"])
@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

0 comments on commit a44e6d9

Please sign in to comment.