aws_sdk_databrew/
auth_plugin.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/*
3 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7use 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// A runtime plugin that registers `StaticAuthSchemeOptionResolver` with `RuntimeComponents`.
15#[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}