You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Xuanwo (via GitHub)" <gi...@apache.org> on 2024/01/05 07:17:11 UTC

Re: [PR] feat(ghaa): add GitHub Action Artifacts support [incubator-opendal]

Xuanwo commented on code in PR #3913:
URL: https://github.com/apache/incubator-opendal/pull/3913#discussion_r1442558431


##########
core/src/services/ghaa/backend.rs:
##########
@@ -0,0 +1,280 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::collections::HashMap;
+use std::fmt::Debug;
+use std::fmt::Formatter;
+use std::sync::Arc;
+
+use async_trait::async_trait;
+use chrono::DateTime;
+use chrono::Utc;
+use http::StatusCode;
+use log::debug;
+use serde::Deserialize;
+
+use super::error::parse_error;
+use crate::raw::*;
+use crate::services::ghaa::core::GhaaCore;
+use crate::services::ghaa::lister::GhaaLister;
+use crate::*;
+
+/// GitHub Action Artifacts services config.
+#[derive(Default, Deserialize, Clone)]
+pub struct GhaaConfig {
+    /// repo's owner of this backend.
+    pub owner: String,
+
+    /// repo name of this backend
+    pub repo: String,
+
+    /// token of this backend
+    ///
+    /// - If the repository is private you must use an access token with the repo scope.
+    /// - You must authenticate using an access token with the repo scope to delete, read artifacts.
+    pub token: Option<String>,
+}
+
+impl Debug for GhaaConfig {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut ds = f.debug_struct("GhaaConfig");
+
+        ds.field("owner", &self.owner);
+        ds.field("repo", &self.repo);
+        if self.token.is_some() {
+            ds.field("token", &"<redacted>");
+        }
+
+        ds.finish()
+    }
+}
+
+/// GitHub Action Artifacts services support.
+#[doc = include_str!("docs.md")]
+#[derive(Default, Clone)]
+pub struct GhaaBuilder {
+    config: GhaaConfig,
+    http_client: Option<HttpClient>,
+}
+
+impl Debug for GhaaBuilder {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        let mut ds = f.debug_struct("Builder");
+
+        ds.field("config", &self.config);
+
+        ds.finish()
+    }
+}
+
+impl GhaaBuilder {
+    /// Set repo's owner of this backend.
+    ///
+    /// The account owner of the repository. The name is not case sensitive.
+    pub fn owner(&mut self, owner: &str) -> &mut Self {
+        if !owner.is_empty() {
+            self.config.owner = owner.to_string();
+        }
+
+        self
+    }
+
+    /// Set repo name of this backend
+    ///
+    /// The name of the repository without the .git extension. The name is not case sensitive.
+    pub fn repo(&mut self, repo: &str) -> &mut Self {
+        if !repo.is_empty() {
+            self.config.repo = repo.to_string();
+        }
+        self
+    }
+
+    /// Set token of this backend
+    ///
+    /// - If the repository is private you must use an access token with the repo scope.
+    /// - You must authenticate using an access token with the repo scope to delete, read artifacts.
+    pub fn token(&mut self, token: &str) -> &mut Self {
+        if !token.is_empty() {
+            self.config.token = Some(token.to_string());
+        }
+
+        self
+    }
+
+    /// Specify the http client that used by this service.
+    ///
+    /// # Notes
+    ///
+    /// This API is part of OpenDAL's Raw API. `HttpClient` could be changed
+    /// during minor updates.
+    pub fn http_client(&mut self, client: HttpClient) -> &mut Self {
+        self.http_client = Some(client);
+        self
+    }
+}
+
+impl Builder for GhaaBuilder {
+    const SCHEME: Scheme = Scheme::Ghaa;
+    type Accessor = GhaaBackend;
+
+    fn from_map(map: HashMap<String, String>) -> Self {
+        let config = GhaaConfig::deserialize(ConfigDeserializer::new(map))
+            .expect("config deserialization must succeed");
+        GhaaBuilder {
+            config,
+            http_client: None,
+        }
+    }
+
+    fn build(&mut self) -> Result<Self::Accessor> {
+        debug!("backend build started: {:?}", self);
+
+        let client = if let Some(client) = self.http_client.take() {
+            client
+        } else {
+            HttpClient::new().map_err(|err| {
+                err.with_operation("Builder::build")
+                    .with_context("service", Scheme::Ghaa)
+            })?
+        };
+
+        let backend = GhaaBackend {
+            core: Arc::new(GhaaCore {
+                client,
+                config: self.config.clone(),
+            }),
+        };
+
+        Ok(backend)
+    }
+}
+
+/// Backend for GitHub Action Artifacts services.
+#[derive(Debug, Clone)]
+pub struct GhaaBackend {
+    core: Arc<GhaaCore>,
+}
+
+#[async_trait]
+impl Accessor for GhaaBackend {
+    type Reader = IncomingAsyncBody;
+    type BlockingReader = ();
+    type Writer = ();
+    type BlockingWriter = ();
+    type Lister = oio::PageLister<GhaaLister>;
+    type BlockingLister = ();
+
+    fn info(&self) -> AccessorInfo {
+        let mut am = AccessorInfo::default();
+        am.set_scheme(Scheme::Ghaa)
+            .set_native_capability(Capability {
+                stat: true,
+                read: true,
+                delete: true,
+                list: true,
+                list_with_limit: true,
+                ..Default::default()
+            });
+        am
+    }
+
+    async fn read(&self, path: &str, _: OpRead) -> Result<(RpRead, Self::Reader)> {
+        let resp = self.core.download_artifact(path).await?;
+        let status = resp.status();
+        match status {
+            StatusCode::OK => Ok((RpRead::new(), resp.into_body())),
+            _ => Err(parse_error(resp).await?),
+        }
+    }
+
+    async fn stat(&self, path: &str, _: OpStat) -> Result<RpStat> {
+        let resp = self.core.stat_artifact(path).await?;
+        let status = resp.status();
+        match status {
+            StatusCode::OK => {
+                let slc = resp.into_body().bytes().await?;
+                let parsed_body: GhaaStatResponse =
+                    serde_json::from_slice(&slc).map_err(new_json_deserialize_error)?;
+
+                let mut meta = Metadata::new(EntryMode::FILE);
+                meta.set_content_length(parsed_body.size_in_bytes);
+                meta.set_last_modified(
+                    DateTime::parse_from_rfc3339(&parsed_body.updated_at)
+                        .map(|dt| dt.with_timezone(&Utc))
+                        .unwrap(),
+                );
+                Ok(RpStat::new(meta))
+            }
+            _ => Err(parse_error(resp).await?),
+        }
+    }
+
+    async fn delete(&self, path: &str, _: OpDelete) -> Result<RpDelete> {
+        let resp = self.core.delete_artifact(path).await?;
+        let status = resp.status();
+        match status {
+            StatusCode::NO_CONTENT => Ok(RpDelete::default()),
+            _ => Err(parse_error(resp).await?),
+        }
+    }
+
+    async fn list(&self, path: &str, args: OpList) -> Result<(RpList, Self::Lister)> {
+        let lister = GhaaLister::new(self.core.clone(), path.to_string(), args.limit());
+        Ok((RpList::default(), oio::PageLister::new(lister)))
+    }
+}
+
+#[derive(Debug, Deserialize)]

Review Comment:
   Let's move all those types into `core`



##########
core/src/services/ghaa/lister.rs:
##########
@@ -0,0 +1,175 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use async_trait::async_trait;
+use chrono::DateTime;
+use chrono::Utc;
+use http::StatusCode;
+use serde::Deserialize;
+use std::sync::Arc;
+
+use super::core::GhaaCore;
+use super::error::parse_error;
+use crate::raw::*;
+use crate::*;
+
+pub struct GhaaLister {
+    core: Arc<GhaaCore>,
+    path: String,
+    limit: Option<usize>,
+}
+
+impl GhaaLister {
+    pub fn new(core: Arc<GhaaCore>, path: String, limit: Option<usize>) -> Self {
+        Self { core, path, limit }
+    }
+}
+
+#[async_trait]
+impl oio::PageList for GhaaLister {
+    async fn next_page(&self, ctx: &mut oio::PageContext) -> Result<()> {
+        if ctx.token.is_empty() {
+            ctx.token = 1.to_string();
+        }
+        let resp = if self.path == "/" {
+            self.core
+                .list_artifacts_under_repo(&ctx.token, &self.limit)
+                .await?
+        } else {
+            self.core
+                .list_artifacts_under_workflow(&self.path, &ctx.token, &self.limit)
+                .await?
+        };
+
+        match resp.status() {
+            StatusCode::OK => {
+                let slc = resp.into_body().bytes().await?;
+                let parsed_body: GhaaListResponse =
+                    serde_json::from_slice(&slc).map_err(new_json_deserialize_error)?;
+
+                for artifact in parsed_body.artifacts {
+                    ctx.entries.push_back(parse_artifact_to_entry(artifact));
+                }
+
+                // parsed_body.artifacts is empty means we have reached the end of the list
+                if ctx.entries.is_empty() {
+                    ctx.done = true;
+                } else {
+                    ctx.token = (ctx.token.parse::<u64>().unwrap() + 1).to_string();
+                }
+
+                Ok(())
+            }
+            _ => Err(parse_error(resp).await?),
+        }
+    }
+}
+
+fn parse_artifact_to_entry(artifact: GhaaArtifact) -> oio::Entry {
+    let meta = Metadata::new(EntryMode::FILE)
+        .with_etag(artifact.id.to_string())

Review Comment:
   Is GitHub indicating that they use `artifact.id` as the ETag, which is a component of HTTP standards?



##########
core/src/services/ghaa/core.rs:
##########
@@ -0,0 +1,185 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt::{Debug, Formatter};
+
+use crate::raw::HttpClient;
+use http::header::ACCEPT;
+use http::header::AUTHORIZATION;
+use http::header::USER_AGENT;
+use http::Request;
+use http::Response;
+
+use crate::raw::*;
+use crate::services::GhaaConfig;
+use crate::*;
+
+/// VERSION is the compiled version of OpenDAL.
+pub const VERSION: &str = env!("CARGO_PKG_VERSION");
+
+const HEADER_GITHUB_API_VERSION: &str = "X-GitHub-Api-Version";
+
+/// The default endpoint suffix for ghaa.
+const DEFAULT_GHAA_ENDPOINT_SUFFIX: &str = "https://api.github.com/repos";
+
+pub struct GhaaCore {
+    pub config: GhaaConfig,
+    pub client: HttpClient,
+}
+
+impl Debug for GhaaCore {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        f.debug_struct("GhaaCore")
+            .field("owner", &self.config.owner)
+            .field("repo", &self.config.repo)
+            .finish_non_exhaustive()
+    }
+}
+impl GhaaCore {
+    pub async fn download_artifact(&self, path: &str) -> Result<Response<IncomingAsyncBody>> {
+        let url: String = format!(
+            "{}/{}/{}/actions/artifacts/{}/zip",

Review Comment:
   The content must be mismatch if we download as a zip.



##########
core/src/services/ghaa/lister.rs:
##########
@@ -0,0 +1,175 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use async_trait::async_trait;
+use chrono::DateTime;
+use chrono::Utc;
+use http::StatusCode;
+use serde::Deserialize;
+use std::sync::Arc;
+
+use super::core::GhaaCore;
+use super::error::parse_error;
+use crate::raw::*;
+use crate::*;
+
+pub struct GhaaLister {
+    core: Arc<GhaaCore>,
+    path: String,
+    limit: Option<usize>,
+}
+
+impl GhaaLister {
+    pub fn new(core: Arc<GhaaCore>, path: String, limit: Option<usize>) -> Self {
+        Self { core, path, limit }
+    }
+}
+
+#[async_trait]
+impl oio::PageList for GhaaLister {
+    async fn next_page(&self, ctx: &mut oio::PageContext) -> Result<()> {
+        if ctx.token.is_empty() {
+            ctx.token = 1.to_string();
+        }
+        let resp = if self.path == "/" {
+            self.core
+                .list_artifacts_under_repo(&ctx.token, &self.limit)
+                .await?
+        } else {
+            self.core
+                .list_artifacts_under_workflow(&self.path, &ctx.token, &self.limit)
+                .await?
+        };
+
+        match resp.status() {
+            StatusCode::OK => {
+                let slc = resp.into_body().bytes().await?;
+                let parsed_body: GhaaListResponse =
+                    serde_json::from_slice(&slc).map_err(new_json_deserialize_error)?;
+
+                for artifact in parsed_body.artifacts {
+                    ctx.entries.push_back(parse_artifact_to_entry(artifact));
+                }
+
+                // parsed_body.artifacts is empty means we have reached the end of the list
+                if ctx.entries.is_empty() {
+                    ctx.done = true;
+                } else {
+                    ctx.token = (ctx.token.parse::<u64>().unwrap() + 1).to_string();
+                }
+
+                Ok(())
+            }
+            _ => Err(parse_error(resp).await?),
+        }
+    }
+}
+
+fn parse_artifact_to_entry(artifact: GhaaArtifact) -> oio::Entry {
+    let meta = Metadata::new(EntryMode::FILE)
+        .with_etag(artifact.id.to_string())
+        .with_content_length(artifact.size_in_bytes as u64)
+        .with_last_modified(
+            DateTime::parse_from_rfc3339(&artifact.updated_at)
+                .map(|dt| dt.with_timezone(&Utc))
+                .unwrap(),
+        );
+    oio::Entry::new(artifact.workflow_run.id.to_string().as_str(), meta)

Review Comment:
   Entry's `path` is the path related to `root` dir, please don't use `workflow_run.id` here.



##########
core/src/services/ghaa/core.rs:
##########
@@ -0,0 +1,185 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt::{Debug, Formatter};
+
+use crate::raw::HttpClient;
+use http::header::ACCEPT;
+use http::header::AUTHORIZATION;
+use http::header::USER_AGENT;
+use http::Request;
+use http::Response;
+
+use crate::raw::*;
+use crate::services::GhaaConfig;
+use crate::*;
+
+/// VERSION is the compiled version of OpenDAL.
+pub const VERSION: &str = env!("CARGO_PKG_VERSION");
+
+const HEADER_GITHUB_API_VERSION: &str = "X-GitHub-Api-Version";
+
+/// The default endpoint suffix for ghaa.
+const DEFAULT_GHAA_ENDPOINT_SUFFIX: &str = "https://api.github.com/repos";
+
+pub struct GhaaCore {
+    pub config: GhaaConfig,
+    pub client: HttpClient,
+}
+
+impl Debug for GhaaCore {
+    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
+        f.debug_struct("GhaaCore")
+            .field("owner", &self.config.owner)
+            .field("repo", &self.config.repo)
+            .finish_non_exhaustive()
+    }
+}
+impl GhaaCore {
+    pub async fn download_artifact(&self, path: &str) -> Result<Response<IncomingAsyncBody>> {
+        let url: String = format!(
+            "{}/{}/{}/actions/artifacts/{}/zip",
+            DEFAULT_GHAA_ENDPOINT_SUFFIX, self.config.owner, self.config.repo, path
+        );
+
+        let mut req = Request::get(&url);
+
+        req = req.header(USER_AGENT, format!("opendal/{VERSION} (service ghaa)"));
+        req = req.header(HEADER_GITHUB_API_VERSION, "2022-11-28");
+        req = req.header(ACCEPT, "application/vnd.github.v3+json");
+
+        if let Some(auth) = &self.config.token {
+            req = req.header(AUTHORIZATION, format!("Bearer {}", auth))
+        }
+
+        let req = req
+            .body(AsyncBody::Empty)
+            .map_err(new_request_build_error)?;
+
+        self.client.send(req).await
+    }
+
+    pub async fn stat_artifact(&self, path: &str) -> Result<Response<IncomingAsyncBody>> {
+        let url: String = format!(
+            "{}/{}/{}/actions/artifacts/{}",
+            DEFAULT_GHAA_ENDPOINT_SUFFIX, self.config.owner, self.config.repo, path
+        );
+
+        let mut req = Request::get(&url);
+        req = req.header(USER_AGENT, format!("opendal/{VERSION} (service ghaa)"));
+        req = req.header(HEADER_GITHUB_API_VERSION, "2022-11-28");
+        req = req.header(ACCEPT, "application/vnd.github.v3+json");
+
+        if let Some(auth) = &self.config.token {
+            req = req.header(AUTHORIZATION, format!("Bearer {}", auth))
+        }
+
+        let req = req
+            .body(AsyncBody::Empty)
+            .map_err(new_request_build_error)?;
+
+        self.client.send(req).await
+    }
+
+    pub async fn delete_artifact(&self, path: &str) -> Result<Response<IncomingAsyncBody>> {
+        let url: String = format!(
+            "{}/{}/{}/actions/artifacts/{}",
+            DEFAULT_GHAA_ENDPOINT_SUFFIX, self.config.owner, self.config.repo, path
+        );
+
+        let mut req = Request::delete(&url);
+        req = req.header(USER_AGENT, format!("opendal/{VERSION} (service ghaa)"));
+        req = req.header(HEADER_GITHUB_API_VERSION, "2022-11-28");
+        req = req.header(ACCEPT, "application/vnd.github.v3+json");
+
+        if let Some(auth) = &self.config.token {
+            req = req.header(AUTHORIZATION, format!("Bearer {}", auth))
+        }
+
+        let req = req
+            .body(AsyncBody::Empty)
+            .map_err(new_request_build_error)?;
+
+        self.client.send(req).await
+    }
+
+    pub async fn list_artifacts_under_repo(

Review Comment:
   I'm not sure about this. OpenDAL requires the services to have path-based name lookup. Maybe we don't need to support this?



##########
core/src/services/ghaa/lister.rs:
##########
@@ -0,0 +1,175 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use async_trait::async_trait;
+use chrono::DateTime;
+use chrono::Utc;
+use http::StatusCode;
+use serde::Deserialize;
+use std::sync::Arc;
+
+use super::core::GhaaCore;
+use super::error::parse_error;
+use crate::raw::*;
+use crate::*;
+
+pub struct GhaaLister {
+    core: Arc<GhaaCore>,
+    path: String,
+    limit: Option<usize>,
+}
+
+impl GhaaLister {
+    pub fn new(core: Arc<GhaaCore>, path: String, limit: Option<usize>) -> Self {
+        Self { core, path, limit }
+    }
+}
+
+#[async_trait]
+impl oio::PageList for GhaaLister {
+    async fn next_page(&self, ctx: &mut oio::PageContext) -> Result<()> {
+        if ctx.token.is_empty() {
+            ctx.token = 1.to_string();
+        }
+        let resp = if self.path == "/" {
+            self.core
+                .list_artifacts_under_repo(&ctx.token, &self.limit)
+                .await?
+        } else {
+            self.core
+                .list_artifacts_under_workflow(&self.path, &ctx.token, &self.limit)
+                .await?
+        };
+
+        match resp.status() {
+            StatusCode::OK => {
+                let slc = resp.into_body().bytes().await?;
+                let parsed_body: GhaaListResponse =
+                    serde_json::from_slice(&slc).map_err(new_json_deserialize_error)?;
+
+                for artifact in parsed_body.artifacts {
+                    ctx.entries.push_back(parse_artifact_to_entry(artifact));
+                }
+
+                // parsed_body.artifacts is empty means we have reached the end of the list
+                if ctx.entries.is_empty() {
+                    ctx.done = true;
+                } else {
+                    ctx.token = (ctx.token.parse::<u64>().unwrap() + 1).to_string();
+                }
+
+                Ok(())
+            }
+            _ => Err(parse_error(resp).await?),
+        }
+    }
+}
+
+fn parse_artifact_to_entry(artifact: GhaaArtifact) -> oio::Entry {
+    let meta = Metadata::new(EntryMode::FILE)
+        .with_etag(artifact.id.to_string())
+        .with_content_length(artifact.size_in_bytes as u64)
+        .with_last_modified(
+            DateTime::parse_from_rfc3339(&artifact.updated_at)

Review Comment:
   Please use existing `opendal::raw::parse_datetime_from_rfc3339`



##########
core/src/services/ghaa/core.rs:
##########
@@ -0,0 +1,185 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::fmt::{Debug, Formatter};
+
+use crate::raw::HttpClient;
+use http::header::ACCEPT;
+use http::header::AUTHORIZATION;
+use http::header::USER_AGENT;
+use http::Request;
+use http::Response;
+
+use crate::raw::*;
+use crate::services::GhaaConfig;
+use crate::*;
+
+/// VERSION is the compiled version of OpenDAL.
+pub const VERSION: &str = env!("CARGO_PKG_VERSION");

Review Comment:
   Please use `opendal::raw::VERSION`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org