@@ -13,29 +13,19 @@ mod ext;
1313use ext:: EventExt ;
1414
1515/// EventBridge bus implementation.
16- ///
17- /// We have to pass a generic type parameter `C` for the underlying client,
18- /// restricted to something that implements the SmithyConnector trait so we can
19- /// use it with both the actual AWS SDK client and a mock implementation.
20- pub struct EventBridgeBus < C > {
21- client : Client < C > ,
16+ pub struct EventBridgeBus {
17+ client : Client ,
2218 bus_name : String ,
2319}
2420
25- impl < C > EventBridgeBus < C >
26- where
27- C : aws_smithy_client:: bounds:: SmithyConnector ,
28- {
29- pub fn new ( client : Client < C > , bus_name : String ) -> Self {
21+ impl EventBridgeBus {
22+ pub fn new ( client : Client , bus_name : String ) -> Self {
3023 Self { client, bus_name }
3124 }
3225}
3326
3427#[ async_trait]
35- impl < C > EventBus for EventBridgeBus < C >
36- where
37- C : aws_smithy_client:: bounds:: SmithyConnector ,
38- {
28+ impl EventBus for EventBridgeBus {
3929 type E = Event ;
4030
4131 /// Publish an event to the event bus.
@@ -89,7 +79,7 @@ mod tests {
8979 use super :: * ;
9080 use crate :: { Event , Product } ;
9181 use aws_sdk_eventbridge:: { Client , Config , Credentials , Region } ;
92- use aws_smithy_client:: test_connection:: TestConnection ;
82+ use aws_smithy_client:: { erase :: DynConnector , test_connection:: TestConnection } ;
9383 use aws_smithy_http:: body:: SdkBody ;
9484
9585 // Config for mocking EventBridge
@@ -132,7 +122,8 @@ mod tests {
132122 . body( SdkBody :: from( "{}" ) )
133123 . unwrap( ) ,
134124 ) ] ) ;
135- let client = Client :: from_conf_conn ( get_mock_config ( ) . await , conn. clone ( ) ) ;
125+ let client =
126+ Client :: from_conf_conn ( get_mock_config ( ) . await , DynConnector :: new ( conn. clone ( ) ) ) ;
136127 let event_bus = EventBridgeBus :: new ( client, "test-bus" . to_string ( ) ) ;
137128
138129 // WHEN we send an event
@@ -167,7 +158,8 @@ mod tests {
167158 . body( SdkBody :: from( "{}" ) )
168159 . unwrap( ) ,
169160 ) ] ) ;
170- let client = Client :: from_conf_conn ( get_mock_config ( ) . await , conn. clone ( ) ) ;
161+ let client =
162+ Client :: from_conf_conn ( get_mock_config ( ) . await , DynConnector :: new ( conn. clone ( ) ) ) ;
171163 let event_bus = EventBridgeBus :: new ( client, "test-bus" . to_string ( ) ) ;
172164
173165 // WHEN we send a batch of events
@@ -200,7 +192,8 @@ mod tests {
200192 async fn test_send_events0 ( ) -> Result < ( ) , Error > {
201193 // GIVEN a mock EventBridge client
202194 let conn: TestConnection < SdkBody > = TestConnection :: new ( vec ! [ ] ) ;
203- let client = Client :: from_conf_conn ( get_mock_config ( ) . await , conn. clone ( ) ) ;
195+ let client =
196+ Client :: from_conf_conn ( get_mock_config ( ) . await , DynConnector :: new ( conn. clone ( ) ) ) ;
204197 let event_bus = EventBridgeBus :: new ( client, "test-bus" . to_string ( ) ) ;
205198
206199 // WHEN we send zero events
@@ -239,7 +232,8 @@ mod tests {
239232 . body( SdkBody :: from( "{}" ) )
240233 . unwrap( ) ,
241234 ) ] ) ;
242- let client = Client :: from_conf_conn ( get_mock_config ( ) . await , conn. clone ( ) ) ;
235+ let client =
236+ Client :: from_conf_conn ( get_mock_config ( ) . await , DynConnector :: new ( conn. clone ( ) ) ) ;
243237 let event_bus = EventBridgeBus :: new ( client, "test-bus" . to_string ( ) ) ;
244238
245239 // WHEN we send 15 events
0 commit comments