Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zwang28 committed Jan 24, 2024
1 parent 0c3ac42 commit 3cd5f06
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
16 changes: 6 additions & 10 deletions src/connector/src/source/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
}
#[derive(Clone, Debug, Deserialize, PartialEq)]
pub struct SecretString(redact::Secret<String>);

impl Serialize for SecretString {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
format!("{:?}", self.inner).serialize(serializer)
format!("{:?}", self.0).serialize(serializer)
}
}

impl WithOptions for redact::Secret<String> {}
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<String>) -> Self {
Self {
inner: redact::Secret::new(s.into()),
}
Self(redact::Secret::new(s.into()))
}
}
6 changes: 3 additions & 3 deletions src/connector/with_options_sink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/connector/with_options_source.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3cd5f06

Please sign in to comment.