Skip to main content

mz_aws_glue_schema_registry/
config.rs

1// Copyright Materialize, Inc. and contributors. All rights reserved.
2//
3// Use of this software is governed by the Business Source License
4// included in the LICENSE file.
5//
6// As of the Change Date specified in that file, in accordance with
7// the Business Source License, use of this software will be governed
8// by the Apache License, Version 2.0.
9
10//! Builder for [`Client`].
11//!
12//! The Glue Schema Registry client is configured from an
13//! [`aws_types::SdkConfig`]. In Materialize, this `SdkConfig` is produced by
14//! `AwsConnection::load_sdk_config`, which threads the region, endpoint
15//! override (used in tests/LocalStack), and credential provider derived from
16//! the user's `AWS CONNECTION`. The Glue client does not need any
17//! Materialize-specific config beyond what `SdkConfig` already carries —
18//! unlike CCSR there is no separate URL or basic-auth.
19
20use aws_types::SdkConfig;
21
22use crate::client::Client;
23
24/// Builder for [`Client`].
25#[derive(Debug, Clone)]
26pub struct ClientConfig {
27    sdk_config: SdkConfig,
28}
29
30impl ClientConfig {
31    /// Construct a new client config from an AWS SDK config.
32    pub fn new(sdk_config: SdkConfig) -> ClientConfig {
33        ClientConfig { sdk_config }
34    }
35
36    /// Build the client. Infallible — the underlying `aws_sdk_glue::Client`
37    /// constructor validates lazily on first request.
38    pub fn build(self) -> Client {
39        Client::from_sdk_config(self.sdk_config)
40    }
41}