Skip to content

Commit 551e26e

Browse files
manaswini1920Manaswini Ragamouni
andauthored
Inject SdkClient into transport actions for SDK persistence support (#2052)
* Inject SdkClient into transport actions for SDK persistence support Add SdkClient as a constructor parameter to all transport actions that perform persistence operations. SdkClient is created by AlertingPlugin and injected via Guice. This wiring enables transport actions to use the Remote Metadata SDK for storage routing in a future change. Signed-off-by: Manaswini Ragamouni <ragamanu@amazon.com> * chore: retrigger CI Signed-off-by: Manaswini Ragamouni <ragamanu@amazon.com> --------- Signed-off-by: Manaswini Ragamouni <ragamanu@amazon.com> Co-authored-by: Manaswini Ragamouni <ragamanu@amazon.com>
1 parent 7fae816 commit 551e26e

16 files changed

Lines changed: 50 additions & 18 deletions

alerting/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,12 @@ configurations.all {
102102
resolutionStrategy {
103103
force "joda-time:joda-time:${versions.joda}"
104104
force "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
105+
force "com.fasterxml.jackson.core:jackson-databind:${versions.jackson_databind}"
106+
force "com.fasterxml.jackson.core:jackson-annotations:${versions.jackson_annotations}"
105107
force "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:${versions.jackson}"
108+
force "com.fasterxml.jackson.dataformat:jackson-dataformat-smile:${versions.jackson}"
109+
force "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${versions.jackson}"
110+
force "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${versions.jackson}"
106111
force "commons-logging:commons-logging:${versions.commonslogging}"
107112
// force the version until OpenSearch upgrade to an invulnerable one, https://www.whitesourcesoftware.com/vulnerability-database/WS-2019-0379
108113
force "commons-codec:commons-codec:1.13"

alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportAcknowledgeAlertAction.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import org.opensearch.core.xcontent.NamedXContentRegistry
4545
import org.opensearch.core.xcontent.XContentParser
4646
import org.opensearch.core.xcontent.XContentParserUtils
4747
import org.opensearch.index.query.QueryBuilders
48+
import org.opensearch.remote.metadata.client.SdkClient
4849
import org.opensearch.rest.RestRequest
4950
import org.opensearch.search.builder.SearchSourceBuilder
5051
import org.opensearch.search.fetch.subphase.FetchSourceContext
@@ -64,7 +65,8 @@ class TransportAcknowledgeAlertAction @Inject constructor(
6465
actionFilters: ActionFilters,
6566
val settings: Settings,
6667
val xContentRegistry: NamedXContentRegistry,
67-
val transportGetMonitorAction: TransportGetMonitorAction
68+
val transportGetMonitorAction: TransportGetMonitorAction,
69+
val sdkClient: SdkClient
6870
) : HandledTransportAction<ActionRequest, AcknowledgeAlertResponse>(
6971
AlertingActions.ACKNOWLEDGE_ALERTS_ACTION_NAME, transportService, actionFilters, ::AcknowledgeAlertRequest
7072
) {

alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportAcknowledgeChainedAlertAction.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import org.opensearch.core.xcontent.NamedXContentRegistry
5252
import org.opensearch.core.xcontent.XContentParser
5353
import org.opensearch.core.xcontent.XContentParserUtils
5454
import org.opensearch.index.query.QueryBuilders
55+
import org.opensearch.remote.metadata.client.SdkClient
5556
import org.opensearch.search.builder.SearchSourceBuilder
5657
import org.opensearch.tasks.Task
5758
import org.opensearch.transport.TransportService
@@ -69,6 +70,7 @@ class TransportAcknowledgeChainedAlertAction @Inject constructor(
6970
actionFilters: ActionFilters,
7071
val settings: Settings,
7172
val xContentRegistry: NamedXContentRegistry,
73+
val sdkClient: SdkClient,
7274
) : HandledTransportAction<ActionRequest, AcknowledgeAlertResponse>(
7375
AlertingActions.ACKNOWLEDGE_CHAINED_ALERTS_ACTION_NAME,
7476
transportService,

alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportDeleteAlertingCommentAction.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import org.opensearch.core.xcontent.NamedXContentRegistry
3838
import org.opensearch.core.xcontent.XContentParser
3939
import org.opensearch.core.xcontent.XContentParserUtils
4040
import org.opensearch.index.query.QueryBuilders
41+
import org.opensearch.remote.metadata.client.SdkClient
4142
import org.opensearch.search.builder.SearchSourceBuilder
4243
import org.opensearch.tasks.Task
4344
import org.opensearch.transport.TransportService
@@ -52,7 +53,8 @@ class TransportDeleteAlertingCommentAction @Inject constructor(
5253
actionFilters: ActionFilters,
5354
val clusterService: ClusterService,
5455
settings: Settings,
55-
val xContentRegistry: NamedXContentRegistry
56+
val xContentRegistry: NamedXContentRegistry,
57+
val sdkClient: SdkClient
5658
) : HandledTransportAction<ActionRequest, DeleteCommentResponse>(
5759
AlertingActions.DELETE_COMMENT_ACTION_NAME, transportService, actionFilters, ::DeleteCommentRequest
5860
),

alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportDeleteMonitorAction.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import org.opensearch.commons.utils.recreateObject
3636
import org.opensearch.core.action.ActionListener
3737
import org.opensearch.core.rest.RestStatus
3838
import org.opensearch.core.xcontent.NamedXContentRegistry
39+
import org.opensearch.remote.metadata.client.SdkClient
3940
import org.opensearch.tasks.Task
4041
import org.opensearch.transport.TransportService
4142
import org.opensearch.transport.client.Client
@@ -49,7 +50,8 @@ class TransportDeleteMonitorAction @Inject constructor(
4950
actionFilters: ActionFilters,
5051
val clusterService: ClusterService,
5152
settings: Settings,
52-
val xContentRegistry: NamedXContentRegistry
53+
val xContentRegistry: NamedXContentRegistry,
54+
val sdkClient: SdkClient
5355
) : HandledTransportAction<ActionRequest, DeleteMonitorResponse>(
5456
AlertingActions.DELETE_MONITOR_ACTION_NAME, transportService, actionFilters, ::DeleteMonitorRequest
5557
),

alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportExecuteMonitorAction.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import org.opensearch.commons.authuser.User
3939
import org.opensearch.core.action.ActionListener
4040
import org.opensearch.core.rest.RestStatus
4141
import org.opensearch.core.xcontent.NamedXContentRegistry
42+
import org.opensearch.remote.metadata.client.SdkClient
4243
import org.opensearch.tasks.Task
4344
import org.opensearch.transport.TransportService
4445
import org.opensearch.transport.client.Client
@@ -56,7 +57,8 @@ class TransportExecuteMonitorAction @Inject constructor(
5657
actionFilters: ActionFilters,
5758
val xContentRegistry: NamedXContentRegistry,
5859
private val docLevelMonitorQueries: DocLevelMonitorQueries,
59-
private val settings: Settings
60+
private val settings: Settings,
61+
private val sdkClient: SdkClient
6062
) : HandledTransportAction<ExecuteMonitorRequest, ExecuteMonitorResponse> (
6163
ExecuteMonitorAction.NAME, transportService, actionFilters, ::ExecuteMonitorRequest
6264
) {

alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetAlertsAction.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import org.opensearch.core.xcontent.XContentParserUtils
4444
import org.opensearch.index.query.BoolQueryBuilder
4545
import org.opensearch.index.query.Operator
4646
import org.opensearch.index.query.QueryBuilders
47+
import org.opensearch.remote.metadata.client.SdkClient
4748
import org.opensearch.search.builder.SearchSourceBuilder
4849
import org.opensearch.search.sort.SortBuilders
4950
import org.opensearch.search.sort.SortOrder
@@ -62,7 +63,8 @@ class TransportGetAlertsAction @Inject constructor(
6263
actionFilters: ActionFilters,
6364
val settings: Settings,
6465
val xContentRegistry: NamedXContentRegistry,
65-
val namedWriteableRegistry: NamedWriteableRegistry
66+
val namedWriteableRegistry: NamedWriteableRegistry,
67+
val sdkClient: SdkClient
6668
) : HandledTransportAction<ActionRequest, GetAlertsResponse>(
6769
AlertingActions.GET_ALERTS_ACTION_NAME,
6870
transportService,

alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetDestinationsAction.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import org.opensearch.core.xcontent.XContentParser
3333
import org.opensearch.core.xcontent.XContentParserUtils
3434
import org.opensearch.index.query.Operator
3535
import org.opensearch.index.query.QueryBuilders
36+
import org.opensearch.remote.metadata.client.SdkClient
3637
import org.opensearch.search.builder.SearchSourceBuilder
3738
import org.opensearch.search.fetch.subphase.FetchSourceContext
3839
import org.opensearch.search.sort.SortBuilders
@@ -50,7 +51,8 @@ class TransportGetDestinationsAction @Inject constructor(
5051
clusterService: ClusterService,
5152
actionFilters: ActionFilters,
5253
val settings: Settings,
53-
val xContentRegistry: NamedXContentRegistry
54+
val xContentRegistry: NamedXContentRegistry,
55+
val sdkClient: SdkClient
5456
) : HandledTransportAction<GetDestinationsRequest, GetDestinationsResponse> (
5557
GetDestinationsAction.NAME, transportService, actionFilters, ::GetDestinationsRequest
5658
),

alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetMonitorAction.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import org.opensearch.core.rest.RestStatus
4343
import org.opensearch.core.xcontent.NamedXContentRegistry
4444
import org.opensearch.index.IndexNotFoundException
4545
import org.opensearch.index.query.QueryBuilders
46+
import org.opensearch.remote.metadata.client.SdkClient
4647
import org.opensearch.search.builder.SearchSourceBuilder
4748
import org.opensearch.tasks.Task
4849
import org.opensearch.transport.RemoteTransportException
@@ -59,6 +60,7 @@ class TransportGetMonitorAction @Inject constructor(
5960
val xContentRegistry: NamedXContentRegistry,
6061
val clusterService: ClusterService,
6162
settings: Settings,
63+
val sdkClient: SdkClient,
6264
) : HandledTransportAction<ActionRequest, GetMonitorResponse>(
6365
AlertingActions.GET_MONITOR_ACTION_NAME,
6466
transportService,

alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetWorkflowAlertsAction.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import org.opensearch.core.xcontent.XContentParser
4040
import org.opensearch.core.xcontent.XContentParserUtils
4141
import org.opensearch.index.query.Operator
4242
import org.opensearch.index.query.QueryBuilders
43+
import org.opensearch.remote.metadata.client.SdkClient
4344
import org.opensearch.search.builder.SearchSourceBuilder
4445
import org.opensearch.search.sort.SortBuilders
4546
import org.opensearch.search.sort.SortOrder
@@ -58,6 +59,7 @@ class TransportGetWorkflowAlertsAction @Inject constructor(
5859
actionFilters: ActionFilters,
5960
val settings: Settings,
6061
val xContentRegistry: NamedXContentRegistry,
62+
val sdkClient: SdkClient,
6163
) : HandledTransportAction<ActionRequest, GetWorkflowAlertsResponse>(
6264
AlertingActions.GET_WORKFLOW_ALERTS_ACTION_NAME,
6365
transportService,

0 commit comments

Comments
 (0)