aws_sdk_sts/
auth_plugin.rs
1use 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)]
15pub(crate) struct DefaultAuthOptionsPlugin {
16 runtime_components: RuntimeComponentsBuilder,
17}
18
19impl DefaultAuthOptionsPlugin {
20 pub(crate) fn new(auth_schemes: Vec<AuthSchemeId>) -> Self {
21 let runtime_components = RuntimeComponentsBuilder::new("default_auth_options")
22 .with_auth_scheme_option_resolver(Some(StaticAuthSchemeOptionResolver::new(auth_schemes)));
23 Self { runtime_components }
24 }
25}
26
27impl RuntimePlugin for DefaultAuthOptionsPlugin {
28 fn order(&self) -> Order {
29 Order::Defaults
30 }
31
32 fn runtime_components(&self, _current_components: &RuntimeComponentsBuilder) -> Cow<'_, RuntimeComponentsBuilder> {
33 Cow::Borrowed(&self.runtime_components)
34 }
35}