1use std::fmt;
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
7pub enum EventsOperation {
8 CreateEventBus,
11 DeleteEventBus,
13 DescribeEventBus,
15 ListEventBuses,
17
18 PutRule,
21 DeleteRule,
23 DescribeRule,
25 ListRules,
27 EnableRule,
29 DisableRule,
31
32 PutTargets,
35 RemoveTargets,
37 ListTargetsByRule,
39
40 PutEvents,
43 TestEventPattern,
45
46 TagResource,
49 UntagResource,
51 ListTagsForResource,
53 PutPermission,
55 RemovePermission,
57 ListRuleNamesByTarget,
59
60 UpdateEventBus,
63
64 CreateArchive,
67 DeleteArchive,
69 DescribeArchive,
71 ListArchives,
73 UpdateArchive,
75 StartReplay,
77 CancelReplay,
79 DescribeReplay,
81 ListReplays,
83
84 CreateApiDestination,
87 DeleteApiDestination,
89 DescribeApiDestination,
91 ListApiDestinations,
93 UpdateApiDestination,
95
96 CreateConnection,
99 DeleteConnection,
101 DescribeConnection,
103 ListConnections,
105 UpdateConnection,
107 DeauthorizeConnection,
109
110 CreateEndpoint,
113 DeleteEndpoint,
115 DescribeEndpoint,
117 ListEndpoints,
119 UpdateEndpoint,
121
122 ActivateEventSource,
125 CreatePartnerEventSource,
127 DeactivateEventSource,
129 DeletePartnerEventSource,
131 DescribeEventSource,
133 DescribePartnerEventSource,
135 ListEventSources,
137 ListPartnerEventSourceAccounts,
139 ListPartnerEventSources,
141 PutPartnerEvents,
143}
144
145impl EventsOperation {
146 #[must_use]
148 pub fn as_str(&self) -> &'static str {
149 match self {
150 Self::CreateEventBus => "CreateEventBus",
151 Self::DeleteEventBus => "DeleteEventBus",
152 Self::DescribeEventBus => "DescribeEventBus",
153 Self::ListEventBuses => "ListEventBuses",
154 Self::PutRule => "PutRule",
155 Self::DeleteRule => "DeleteRule",
156 Self::DescribeRule => "DescribeRule",
157 Self::ListRules => "ListRules",
158 Self::EnableRule => "EnableRule",
159 Self::DisableRule => "DisableRule",
160 Self::PutTargets => "PutTargets",
161 Self::RemoveTargets => "RemoveTargets",
162 Self::ListTargetsByRule => "ListTargetsByRule",
163 Self::PutEvents => "PutEvents",
164 Self::TestEventPattern => "TestEventPattern",
165 Self::TagResource => "TagResource",
166 Self::UntagResource => "UntagResource",
167 Self::ListTagsForResource => "ListTagsForResource",
168 Self::PutPermission => "PutPermission",
169 Self::RemovePermission => "RemovePermission",
170 Self::ListRuleNamesByTarget => "ListRuleNamesByTarget",
171 Self::UpdateEventBus => "UpdateEventBus",
172 Self::CreateArchive => "CreateArchive",
173 Self::DeleteArchive => "DeleteArchive",
174 Self::DescribeArchive => "DescribeArchive",
175 Self::ListArchives => "ListArchives",
176 Self::UpdateArchive => "UpdateArchive",
177 Self::StartReplay => "StartReplay",
178 Self::CancelReplay => "CancelReplay",
179 Self::DescribeReplay => "DescribeReplay",
180 Self::ListReplays => "ListReplays",
181 Self::CreateApiDestination => "CreateApiDestination",
182 Self::DeleteApiDestination => "DeleteApiDestination",
183 Self::DescribeApiDestination => "DescribeApiDestination",
184 Self::ListApiDestinations => "ListApiDestinations",
185 Self::UpdateApiDestination => "UpdateApiDestination",
186 Self::CreateConnection => "CreateConnection",
187 Self::DeleteConnection => "DeleteConnection",
188 Self::DescribeConnection => "DescribeConnection",
189 Self::ListConnections => "ListConnections",
190 Self::UpdateConnection => "UpdateConnection",
191 Self::DeauthorizeConnection => "DeauthorizeConnection",
192 Self::CreateEndpoint => "CreateEndpoint",
193 Self::DeleteEndpoint => "DeleteEndpoint",
194 Self::DescribeEndpoint => "DescribeEndpoint",
195 Self::ListEndpoints => "ListEndpoints",
196 Self::UpdateEndpoint => "UpdateEndpoint",
197 Self::ActivateEventSource => "ActivateEventSource",
198 Self::CreatePartnerEventSource => "CreatePartnerEventSource",
199 Self::DeactivateEventSource => "DeactivateEventSource",
200 Self::DeletePartnerEventSource => "DeletePartnerEventSource",
201 Self::DescribeEventSource => "DescribeEventSource",
202 Self::DescribePartnerEventSource => "DescribePartnerEventSource",
203 Self::ListEventSources => "ListEventSources",
204 Self::ListPartnerEventSourceAccounts => "ListPartnerEventSourceAccounts",
205 Self::ListPartnerEventSources => "ListPartnerEventSources",
206 Self::PutPartnerEvents => "PutPartnerEvents",
207 }
208 }
209
210 #[must_use]
212 pub fn from_name(name: &str) -> Option<Self> {
213 match name {
214 "CreateEventBus" => Some(Self::CreateEventBus),
215 "DeleteEventBus" => Some(Self::DeleteEventBus),
216 "DescribeEventBus" => Some(Self::DescribeEventBus),
217 "ListEventBuses" => Some(Self::ListEventBuses),
218 "PutRule" => Some(Self::PutRule),
219 "DeleteRule" => Some(Self::DeleteRule),
220 "DescribeRule" => Some(Self::DescribeRule),
221 "ListRules" => Some(Self::ListRules),
222 "EnableRule" => Some(Self::EnableRule),
223 "DisableRule" => Some(Self::DisableRule),
224 "PutTargets" => Some(Self::PutTargets),
225 "RemoveTargets" => Some(Self::RemoveTargets),
226 "ListTargetsByRule" => Some(Self::ListTargetsByRule),
227 "PutEvents" => Some(Self::PutEvents),
228 "TestEventPattern" => Some(Self::TestEventPattern),
229 "TagResource" => Some(Self::TagResource),
230 "UntagResource" => Some(Self::UntagResource),
231 "ListTagsForResource" => Some(Self::ListTagsForResource),
232 "PutPermission" => Some(Self::PutPermission),
233 "RemovePermission" => Some(Self::RemovePermission),
234 "ListRuleNamesByTarget" => Some(Self::ListRuleNamesByTarget),
235 "UpdateEventBus" => Some(Self::UpdateEventBus),
236 "CreateArchive" => Some(Self::CreateArchive),
237 "DeleteArchive" => Some(Self::DeleteArchive),
238 "DescribeArchive" => Some(Self::DescribeArchive),
239 "ListArchives" => Some(Self::ListArchives),
240 "UpdateArchive" => Some(Self::UpdateArchive),
241 "StartReplay" => Some(Self::StartReplay),
242 "CancelReplay" => Some(Self::CancelReplay),
243 "DescribeReplay" => Some(Self::DescribeReplay),
244 "ListReplays" => Some(Self::ListReplays),
245 "CreateApiDestination" => Some(Self::CreateApiDestination),
246 "DeleteApiDestination" => Some(Self::DeleteApiDestination),
247 "DescribeApiDestination" => Some(Self::DescribeApiDestination),
248 "ListApiDestinations" => Some(Self::ListApiDestinations),
249 "UpdateApiDestination" => Some(Self::UpdateApiDestination),
250 "CreateConnection" => Some(Self::CreateConnection),
251 "DeleteConnection" => Some(Self::DeleteConnection),
252 "DescribeConnection" => Some(Self::DescribeConnection),
253 "ListConnections" => Some(Self::ListConnections),
254 "UpdateConnection" => Some(Self::UpdateConnection),
255 "DeauthorizeConnection" => Some(Self::DeauthorizeConnection),
256 "CreateEndpoint" => Some(Self::CreateEndpoint),
257 "DeleteEndpoint" => Some(Self::DeleteEndpoint),
258 "DescribeEndpoint" => Some(Self::DescribeEndpoint),
259 "ListEndpoints" => Some(Self::ListEndpoints),
260 "UpdateEndpoint" => Some(Self::UpdateEndpoint),
261 "ActivateEventSource" => Some(Self::ActivateEventSource),
262 "CreatePartnerEventSource" => Some(Self::CreatePartnerEventSource),
263 "DeactivateEventSource" => Some(Self::DeactivateEventSource),
264 "DeletePartnerEventSource" => Some(Self::DeletePartnerEventSource),
265 "DescribeEventSource" => Some(Self::DescribeEventSource),
266 "DescribePartnerEventSource" => Some(Self::DescribePartnerEventSource),
267 "ListEventSources" => Some(Self::ListEventSources),
268 "ListPartnerEventSourceAccounts" => Some(Self::ListPartnerEventSourceAccounts),
269 "ListPartnerEventSources" => Some(Self::ListPartnerEventSources),
270 "PutPartnerEvents" => Some(Self::PutPartnerEvents),
271 _ => None,
272 }
273 }
274
275 #[must_use]
277 pub fn is_implemented(&self) -> bool {
278 matches!(
279 self,
280 Self::CreateEventBus
282 | Self::DeleteEventBus
283 | Self::DescribeEventBus
284 | Self::ListEventBuses
285 | Self::PutRule
286 | Self::DeleteRule
287 | Self::DescribeRule
288 | Self::ListRules
289 | Self::EnableRule
290 | Self::DisableRule
291 | Self::PutTargets
292 | Self::RemoveTargets
293 | Self::ListTargetsByRule
294 | Self::PutEvents
295 | Self::TestEventPattern
296 | Self::TagResource
298 | Self::UntagResource
299 | Self::ListTagsForResource
300 | Self::PutPermission
301 | Self::RemovePermission
302 | Self::ListRuleNamesByTarget
303 | Self::UpdateEventBus
305 | Self::CreateArchive
307 | Self::DeleteArchive
308 | Self::DescribeArchive
309 | Self::ListArchives
310 | Self::UpdateArchive
311 | Self::StartReplay
313 | Self::CancelReplay
314 | Self::DescribeReplay
315 | Self::ListReplays
316 | Self::CreateApiDestination
318 | Self::DeleteApiDestination
319 | Self::DescribeApiDestination
320 | Self::ListApiDestinations
321 | Self::UpdateApiDestination
322 | Self::CreateConnection
324 | Self::DeleteConnection
325 | Self::DescribeConnection
326 | Self::ListConnections
327 | Self::UpdateConnection
328 | Self::DeauthorizeConnection
329 | Self::CreateEndpoint
331 | Self::DeleteEndpoint
332 | Self::DescribeEndpoint
333 | Self::ListEndpoints
334 | Self::UpdateEndpoint
335 )
336 }
337}
338
339impl fmt::Display for EventsOperation {
340 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
341 f.write_str(self.as_str())
342 }
343}