From 3cd5f0630dd221ec023f1e2e328a751f59cc116d Mon Sep 17 00:00:00 2001 From: zwang28 <84491488@qq.com> Date: Wed, 24 Jan 2024 11:49:30 +0800 Subject: [PATCH] fix tests --- src/connector/src/source/common.rs | 16 ++++++---------- src/connector/with_options_sink.yaml | 6 +++--- src/connector/with_options_source.yaml | 8 ++++---- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/connector/src/source/common.rs b/src/connector/src/source/common.rs index 0668e667c5b99..fcea7989a9ad1 100644 --- a/src/connector/src/source/common.rs +++ b/src/connector/src/source/common.rs @@ -77,30 +77,26 @@ pub(crate) async fn into_chunk_stream( } } -#[derive(Clone, Debug, Deserialize, PartialEq, with_options::WithOptions)] -pub struct SecretString { - inner: redact::Secret, -} +#[derive(Clone, Debug, Deserialize, PartialEq)] +pub struct SecretString(redact::Secret); impl Serialize for SecretString { fn serialize(&self, serializer: S) -> Result where S: Serializer, { - format!("{:?}", self.inner).serialize(serializer) + format!("{:?}", self.0).serialize(serializer) } } -impl WithOptions for redact::Secret {} +impl WithOptions for SecretString {} impl SecretString { pub fn expose_secret(&self) -> &String { - self.inner.expose_secret() + self.0.expose_secret() } pub fn new(s: impl Into) -> Self { - Self { - inner: redact::Secret::new(s.into()), - } + Self(redact::Secret::new(s.into())) } } diff --git a/src/connector/with_options_sink.yaml b/src/connector/with_options_sink.yaml index b74ccb9814e59..277e05b4fd5e4 100644 --- a/src/connector/with_options_sink.yaml +++ b/src/connector/with_options_sink.yaml @@ -28,7 +28,7 @@ BigQueryConfig: field_type: String required: false - name: secret_key - field_type: String + field_type: SecretString required: false - name: session_token field_type: String @@ -324,7 +324,7 @@ KinesisSinkConfig: required: false alias: kinesis.credentials.access - name: aws.credentials.secret_access_key - field_type: String + field_type: SecretString required: false alias: kinesis.credentials.secret - name: aws.credentials.session_token @@ -424,7 +424,7 @@ PulsarConfig: field_type: String required: false - name: secret_key - field_type: String + field_type: SecretString required: false - name: session_token field_type: String diff --git a/src/connector/with_options_source.yaml b/src/connector/with_options_source.yaml index 84a125813733e..161a5555814a4 100644 --- a/src/connector/with_options_source.yaml +++ b/src/connector/with_options_source.yaml @@ -195,7 +195,7 @@ KinesisProperties: required: false alias: kinesis.credentials.access - name: aws.credentials.secret_access_key - field_type: String + field_type: SecretString required: false alias: kinesis.credentials.secret - name: aws.credentials.session_token @@ -447,7 +447,7 @@ OpendalS3Properties: required: false default: Default::default - name: s3.credentials.secret - field_type: String + field_type: SecretString required: false default: Default::default - name: s3.endpoint_url @@ -535,7 +535,7 @@ PulsarProperties: field_type: String required: false - name: secret_key - field_type: String + field_type: SecretString required: false - name: session_token field_type: String @@ -574,7 +574,7 @@ S3Properties: required: false default: Default::default - name: s3.credentials.secret - field_type: String + field_type: SecretString required: false default: Default::default - name: s3.endpoint_url