@@ -22,18 +22,25 @@ pub struct ListGroupsParams {
22
22
}
23
23
24
24
pub struct ListGroupsParamsBuilder {
25
+ client : Option < CloudWatchLogsClient > ,
25
26
out : Option < Box < dyn Write > > ,
26
27
err : Option < Box < dyn Write > > ,
27
28
}
28
29
29
30
impl ListGroupsParamsBuilder {
30
31
pub fn new ( ) -> ListGroupsParamsBuilder {
31
32
ListGroupsParamsBuilder {
33
+ client : None ,
32
34
out : None ,
33
35
err : None ,
34
36
}
35
37
}
36
38
39
+ pub fn with_client ( mut self , client : CloudWatchLogsClient ) -> ListGroupsParamsBuilder {
40
+ self . client = Some ( client) ;
41
+ self
42
+ }
43
+
37
44
pub fn with_out ( mut self , out : Box < dyn Write > ) -> ListGroupsParamsBuilder {
38
45
self . out = Some ( out) ;
39
46
self
@@ -46,7 +53,9 @@ impl ListGroupsParamsBuilder {
46
53
47
54
pub fn build ( self ) -> ListGroupsParams {
48
55
return ListGroupsParams {
49
- client : CloudWatchLogsClient :: new ( Region :: default ( ) ) ,
56
+ client : self
57
+ . client
58
+ . unwrap_or ( CloudWatchLogsClient :: new ( Region :: default ( ) ) ) ,
50
59
out : self . out . unwrap_or ( Box :: new ( stdout ( ) ) ) ,
51
60
err : self . err . unwrap_or ( Box :: new ( stderr ( ) ) ) ,
52
61
} ;
@@ -109,6 +118,7 @@ pub struct ListStreamsParams {
109
118
110
119
pub struct ListStreamsParamsBuilder {
111
120
log_group_name : String ,
121
+ client : Option < CloudWatchLogsClient > ,
112
122
out : Option < Box < dyn Write > > ,
113
123
err : Option < Box < dyn Write > > ,
114
124
}
@@ -117,11 +127,17 @@ impl ListStreamsParamsBuilder {
117
127
pub fn new ( log_group_name : String ) -> ListStreamsParamsBuilder {
118
128
ListStreamsParamsBuilder {
119
129
log_group_name,
130
+ client : None ,
120
131
out : None ,
121
132
err : None ,
122
133
}
123
134
}
124
135
136
+ pub fn with_client ( mut self , client : CloudWatchLogsClient ) -> ListStreamsParamsBuilder {
137
+ self . client = Some ( client) ;
138
+ self
139
+ }
140
+
125
141
pub fn with_out ( mut self , out : Box < dyn Write > ) -> ListStreamsParamsBuilder {
126
142
self . out = Some ( out) ;
127
143
self
@@ -135,7 +151,9 @@ impl ListStreamsParamsBuilder {
135
151
pub fn build ( self ) -> ListStreamsParams {
136
152
return ListStreamsParams {
137
153
log_group_name : self . log_group_name ,
138
- client : CloudWatchLogsClient :: new ( Region :: default ( ) ) ,
154
+ client : self
155
+ . client
156
+ . unwrap_or ( CloudWatchLogsClient :: new ( Region :: default ( ) ) ) ,
139
157
out : self . out . unwrap_or ( Box :: new ( stdout ( ) ) ) ,
140
158
err : self . err . unwrap_or ( Box :: new ( stderr ( ) ) ) ,
141
159
} ;
@@ -212,6 +230,7 @@ pub struct ListEventsParamsBuilder {
212
230
log_group_name : String ,
213
231
start : Option < String > ,
214
232
end : Option < String > ,
233
+ client : Option < CloudWatchLogsClient > ,
215
234
out : Option < Box < dyn Write > > ,
216
235
err : Option < Box < dyn Write > > ,
217
236
}
@@ -226,11 +245,17 @@ impl ListEventsParamsBuilder {
226
245
log_group_name,
227
246
start,
228
247
end,
248
+ client : None ,
229
249
out : None ,
230
250
err : None ,
231
251
}
232
252
}
233
253
254
+ pub fn with_client ( mut self , client : CloudWatchLogsClient ) -> ListEventsParamsBuilder {
255
+ self . client = Some ( client) ;
256
+ self
257
+ }
258
+
234
259
pub fn with_out ( mut self , out : Box < dyn Write > ) -> ListEventsParamsBuilder {
235
260
self . out = Some ( out) ;
236
261
self
@@ -246,7 +271,9 @@ impl ListEventsParamsBuilder {
246
271
log_group_name : self . log_group_name ,
247
272
start : self . start ,
248
273
end : self . end ,
249
- client : CloudWatchLogsClient :: new ( Region :: default ( ) ) ,
274
+ client : self
275
+ . client
276
+ . unwrap_or ( CloudWatchLogsClient :: new ( Region :: default ( ) ) ) ,
250
277
out : self . out . unwrap_or ( Box :: new ( stdout ( ) ) ) ,
251
278
err : self . err . unwrap_or ( Box :: new ( stderr ( ) ) ) ,
252
279
} ;
0 commit comments