From 7c31df5b6a835b9e587c5bb9809cd557b91744da Mon Sep 17 00:00:00 2001 From: "Heinz N. Gies" Date: Fri, 19 Jul 2024 18:26:33 +0200 Subject: [PATCH] Fix url and connector naming Signed-off-by: Heinz N. Gies --- CHANGELOG.md | 6 ++++++ tremor-connectors-gcp/src/gcs.rs | 2 +- tremor-connectors-gcp/src/gcs/resumable_upload_client.rs | 9 ++++++--- tremor-connectors-gcp/src/gcs/streamer.rs | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76bc619df1..95827ba2e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixes +* gbq connector naming is now `gbq_writer` as it is documented +* fix gbq connector url missing `/` + ## [0.13.0-rc.29] ### New features diff --git a/tremor-connectors-gcp/src/gcs.rs b/tremor-connectors-gcp/src/gcs.rs index 74fb11b3e7..299373a3fb 100644 --- a/tremor-connectors-gcp/src/gcs.rs +++ b/tremor-connectors-gcp/src/gcs.rs @@ -51,7 +51,7 @@ //! //! | name | description | default | //! |---------------------|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------| -//! | `url` | The HTTP(s) endpoint to which the requests will be made | `"https://storage.googleapis.com/upload/storage/v1"` | +//! | `url` | The HTTP(s) endpoint to which the requests will be made | `"https://storage.googleapis.com/upload/storage/v1/"` | //! | `bucket` | The optional bucket to stream events into if not overwritten by event metadata `$gcs_streamer.bucket` | | //! | `mode` | The mode of operation for this connector. See [Modes of operation](#modes-of-operation). | | //! | `connect_timeout` | The timeout for the connection (in nanoseconds) | `10_000_000_000` (10 seconds) | diff --git a/tremor-connectors-gcp/src/gcs/resumable_upload_client.rs b/tremor-connectors-gcp/src/gcs/resumable_upload_client.rs index 9f5fbe95bf..ad99b4af6f 100644 --- a/tremor-connectors-gcp/src/gcs/resumable_upload_client.rs +++ b/tremor-connectors-gcp/src/gcs/resumable_upload_client.rs @@ -151,7 +151,7 @@ impl bucket: &str, ) -> anyhow::Result { let mut response = retriable_request(&self.backoff_strategy, &mut self.client, || { - let url = format!("{url}/b/{bucket}"); + let url = url.join("b/")?.join(bucket)?.to_string(); Ok(Request::builder() .method(Method::GET) .uri(url) @@ -457,7 +457,7 @@ mod tests { async fn can_bucket_exists() -> anyhow::Result<()> { let client = MockHttpClient { handle_request: Box::new(|req| { - assert_eq!(req.uri().path(), "/b/snot"); + assert_eq!(req.uri().path(), "/upload/storage/v1/b/snot"); assert_eq!(req.method(), Method::GET); let response = Response::builder() @@ -476,7 +476,10 @@ mod tests { }, }; let bucket_exists = api_client - .bucket_exists(&Url::parse("http://example.com")?, "snot") + .bucket_exists( + &Url::parse("https://storage.googleapis.com/upload/storage/v1/")?, + "snot", + ) .await?; assert!(bucket_exists); Ok(()) diff --git a/tremor-connectors-gcp/src/gcs/streamer.rs b/tremor-connectors-gcp/src/gcs/streamer.rs index ea016b7445..9b7bd8d3cc 100644 --- a/tremor-connectors-gcp/src/gcs/streamer.rs +++ b/tremor-connectors-gcp/src/gcs/streamer.rs @@ -62,7 +62,7 @@ pub(super) struct Config { #[allow(clippy::unwrap_used)] fn default_endpoint() -> Url { // ALLOW: this URL is hardcoded, so the only reason for parse failing would be if it was changed - Url::parse("https://storage.googleapis.com/upload/storage/v1").unwrap() + Url::parse("https://storage.googleapis.com/upload/storage/v1/").unwrap() } fn default_connect_timeout() -> u64 {