aws_sdk_databrew/
auth_plugin.rs1use std::borrow::Cow;
8
9use aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolver;
10use aws_smithy_runtime_api::client::auth::AuthSchemeId;
11use aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder;
12use aws_smithy_runtime_api::client::runtime_plugin::{Order, RuntimePlugin};
13
14#[derive(Debug)]
16pub(crate) struct DefaultAuthOptionsPlugin {
17 runtime_components: RuntimeComponentsBuilder,
18}
19
20impl DefaultAuthOptionsPlugin {
21 pub(crate) fn new(auth_schemes: Vec<AuthSchemeId>) -> Self {
22 let runtime_components = RuntimeComponentsBuilder::new("default_auth_options")
23 .with_auth_scheme_option_resolver(Some(StaticAuthSchemeOptionResolver::new(auth_schemes)));
24 Self { runtime_components }
25 }
26}
27
28impl RuntimePlugin for DefaultAuthOptionsPlugin {
29 fn order(&self) -> Order {
30 Order::Defaults
31 }
32
33 fn runtime_components(&self, _current_components: &RuntimeComponentsBuilder) -> Cow<'_, RuntimeComponentsBuilder> {
34 Cow::Borrowed(&self.runtime_components)
35 }
36}