This is an automated email from the ASF dual-hosted git repository. Xuanwo pushed a commit to branch xuanwo/feat-obs-default-provider-and-security-token in repository https://gitbox.apache.org/repos/asf/opendal.git
commit dfd788db6dc4b22a8085a3cde14cfe531cdc0863 Author: Xuanwo <[email protected]> AuthorDate: Mon Nov 23 14:18:40 2026 +0100 feat(services/obs): adopt DefaultCredentialProvider and support security_token, disable_config_load, and skip_signature --- .../OpenDAL/ServiceConfig/ObsServiceConfig.cs | 24 +++ .../java/org/apache/opendal/ServiceConfig.java | 32 ++++ bindings/python/python/opendal/config.py | 6 + core/services/obs/src/backend.rs | 192 ++++++++++++++++++++- core/services/obs/src/config.rs | 36 ++++ core/services/obs/src/core.rs | 115 ++++++++++++ core/services/obs/src/docs.md | 14 ++ website/data/services.json | 33 +++- 8 files changed, 437 insertions(+), 15 deletions(-) diff --git a/bindings/dotnet/OpenDAL/ServiceConfig/ObsServiceConfig.cs b/bindings/dotnet/OpenDAL/ServiceConfig/ObsServiceConfig.cs index 34b9aa7299..1af8cce09e 100644 --- a/bindings/dotnet/OpenDAL/ServiceConfig/ObsServiceConfig.cs +++ b/bindings/dotnet/OpenDAL/ServiceConfig/ObsServiceConfig.cs @@ -37,6 +37,10 @@ namespace OpenDAL.ServiceConfig /// </summary> public string? Bucket { get; init; } /// <summary> + /// Disable config load so that opendal will not load config from environment. For examples: - envs like `HUAWEI_CLOUD_ACCESS_KEY_ID` + /// </summary> + public bool? DisableConfigLoad { get; init; } + /// <summary> /// Deprecated: OBS versioning capability is not controlled by service config. /// </summary> [System.Obsolete("OBS versioning capability is not controlled by this option and this option is no longer needed.")] @@ -53,6 +57,14 @@ namespace OpenDAL.ServiceConfig /// Secret access key for obs. /// </summary> public string? SecretAccessKey { get; init; } + /// <summary> + /// Security token (a.k.a. session token) for obs. Temporary credentials sign with `access_key_id`, `secret_access_key` and this token, and the signer attaches the token as the `x-obs-security-token` header. If this field is not set, OpenDAL reads the token from the environment variable `HUAWEI_CLOUD_SECURITY_TOKEN` (unless `disable_config_load` is enabled). + /// </summary> + public string? SecurityToken { get; init; } + /// <summary> + /// Skip signature will skip loading credentials and signing requests. + /// </summary> + public bool? SkipSignature { get; init; } public string Scheme => "obs"; @@ -67,6 +79,10 @@ namespace OpenDAL.ServiceConfig { map["bucket"] = Utilities.ToOptionString(Bucket); } + if (DisableConfigLoad is not null) + { + map["disable_config_load"] = Utilities.ToOptionString(DisableConfigLoad); + } #pragma warning disable CS0618 if (EnableVersioning is not null) { @@ -85,6 +101,14 @@ namespace OpenDAL.ServiceConfig { map["secret_access_key"] = Utilities.ToOptionString(SecretAccessKey); } + if (SecurityToken is not null) + { + map["security_token"] = Utilities.ToOptionString(SecurityToken); + } + if (SkipSignature is not null) + { + map["skip_signature"] = Utilities.ToOptionString(SkipSignature); + } return map; } } diff --git a/bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java b/bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java index 5a17f08638..b87d6e93aa 100644 --- a/bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java +++ b/bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java @@ -2418,6 +2418,15 @@ public interface ServiceConfig { * <p>Bucket for obs.</p> */ public final String bucket; + /** + * <p>Disable config load so that opendal will not load config from + * environment.</p> + * <p>For examples:</p> + * <ul> + * <li>envs like <code>HUAWEI_CLOUD_ACCESS_KEY_ID</code></li> + * </ul> + */ + public final Boolean disableConfigLoad; /** * <p>Deprecated: OBS versioning capability is not controlled by service config.</p> * @@ -2436,6 +2445,20 @@ public interface ServiceConfig { * <p>Secret access key for obs.</p> */ public final String secretAccessKey; + /** + * <p>Security token (a.k.a. session token) for obs.</p> + * <p>Temporary credentials sign with <code>access_key_id</code>, <code>secret_access_key</code> and + * this token, and the signer attaches the token as the + * <code>x-obs-security-token</code> header.</p> + * <p>If this field is not set, OpenDAL reads the token from the environment + * variable <code>HUAWEI_CLOUD_SECURITY_TOKEN</code> (unless <code>disable_config_load</code> is + * enabled).</p> + */ + public final String securityToken; + /** + * <p>Skip signature will skip loading credentials and signing requests.</p> + */ + public final Boolean skipSignature; @Override public String scheme() { @@ -2451,6 +2474,9 @@ public interface ServiceConfig { if (bucket != null) { map.put("bucket", bucket); } + if (disableConfigLoad != null) { + map.put("disable_config_load", String.valueOf(disableConfigLoad)); + } if (enableVersioning != null) { map.put("enable_versioning", String.valueOf(enableVersioning)); } @@ -2463,6 +2489,12 @@ public interface ServiceConfig { if (secretAccessKey != null) { map.put("secret_access_key", secretAccessKey); } + if (securityToken != null) { + map.put("security_token", securityToken); + } + if (skipSignature != null) { + map.put("skip_signature", String.valueOf(skipSignature)); + } return map; } } diff --git a/bindings/python/python/opendal/config.py b/bindings/python/python/opendal/config.py index d0e816466e..328e8dcf27 100644 --- a/bindings/python/python/opendal/config.py +++ b/bindings/python/python/opendal/config.py @@ -615,6 +615,8 @@ class ObsConfig(TypedDict): """Access key id for obs.""" bucket: NotRequired[str] """Bucket for obs.""" + disable_config_load: NotRequired[bool] + """Disable config load so that opendal will not load config from environment. For examples: - envs like `HUAWEI_CLOUD_ACCESS_KEY_ID`""" enable_versioning: NotRequired[bool] """Deprecated: OBS versioning capability is not controlled by service config. [Deprecated since 0.57.0] OBS versioning capability is not controlled by this option and this option is no longer needed.""" endpoint: NotRequired[str] @@ -623,6 +625,10 @@ class ObsConfig(TypedDict): """Root for obs.""" secret_access_key: NotRequired[str] """Secret access key for obs.""" + security_token: NotRequired[str] + """Security token (a.k.a. session token) for obs. Temporary credentials sign with `access_key_id`, `secret_access_key` and this token, and the signer attaches the token as the `x-obs-security-token` header. If this field is not set, OpenDAL reads the token from the environment variable `HUAWEI_CLOUD_SECURITY_TOKEN` (unless `disable_config_load` is enabled).""" + skip_signature: NotRequired[bool] + """Skip signature will skip loading credentials and signing requests.""" class OnedriveConfig(TypedDict): diff --git a/core/services/obs/src/backend.rs b/core/services/obs/src/backend.rs index 6b859526a8..6855d5a287 100644 --- a/core/services/obs/src/backend.rs +++ b/core/services/obs/src/backend.rs @@ -26,10 +26,9 @@ use opendal_core::raw::*; use opendal_core::*; use reqsign_core::Context; use reqsign_core::OsEnv; -use reqsign_core::ProvideCredentialChain; use reqsign_core::Signer; use reqsign_file_read_tokio::TokioFileRead; -use reqsign_huaweicloud_obs::EnvCredentialProvider; +use reqsign_huaweicloud_obs::DefaultCredentialProvider; use reqsign_huaweicloud_obs::RequestSigner; use reqsign_huaweicloud_obs::StaticCredentialProvider; @@ -111,6 +110,23 @@ impl ObsBuilder { self } + /// Set security_token of this backend. + /// + /// Use this together with `access_key_id` and `secret_access_key` when the + /// credentials are temporary. The signer attaches the token as the + /// `x-obs-security-token` header. + /// + /// - If it is set, we will take user's input first. + /// - If not, we will try to load it from environment (unless + /// `disable_config_load` is enabled). + pub fn security_token(mut self, security_token: &str) -> Self { + if !security_token.is_empty() { + self.config.security_token = Some(security_token.to_string()); + } + + self + } + /// Set bucket of this backend. /// The param is required. pub fn bucket(mut self, bucket: &str) -> Self { @@ -121,6 +137,23 @@ impl ObsBuilder { self } + /// Disable config load so that opendal will not load config from + /// environment. + /// + /// For examples: + /// + /// - envs like `HUAWEI_CLOUD_ACCESS_KEY_ID` + pub fn disable_config_load(mut self) -> Self { + self.config.disable_config_load = true; + self + } + + /// Skip signature will skip loading credentials and signing requests. + pub fn skip_signature(mut self) -> Self { + self.config.skip_signature = true; + self + } + /// Deprecated: OBS versioning capability is not controlled by service config. #[deprecated( since = "0.57.0", @@ -137,7 +170,7 @@ impl Builder for ObsBuilder { fn build(self) -> Result<impl Service> { debug!("backend build started: {:?}", self); - let root = normalize_root(&self.config.root.unwrap_or_default()); + let root = normalize_root(&self.config.root.clone().unwrap_or_default()); debug!("backend use root {root}"); let bucket = match &self.config.bucket { @@ -178,12 +211,7 @@ impl Builder for ObsBuilder { let ctx = Context::new().with_file_read(TokioFileRead).with_env(OsEnv); - let mut provider = ProvideCredentialChain::new().push(EnvCredentialProvider::new()); - - if let (Some(ak), Some(sk)) = (&self.config.access_key_id, &self.config.secret_access_key) { - let static_provider = StaticCredentialProvider::new(ak, sk); - provider = provider.push_front(static_provider); - } + let provider = credential_provider(&self.config); // Set the bucket name in CanonicalizedResource. // 1. If the bucket is bound to a user domain name, use the user domain name as the bucket name, @@ -253,12 +281,38 @@ impl Builder for ObsBuilder { bucket, root, endpoint: format!("{}://{}", scheme, endpoint), + skip_signature: self.config.skip_signature, signer, }), }) } } +/// Build the credential chain used by the signer. +/// +/// Explicit static credentials always take precedence over the environment. +/// `disable_config_load` drops the environment provider so that ambient +/// credentials are never loaded. +pub(super) fn credential_provider(config: &ObsConfig) -> DefaultCredentialProvider { + let provider = if config.disable_config_load { + DefaultCredentialProvider::builder().no_env().build() + } else { + DefaultCredentialProvider::builder().build() + }; + + match (&config.access_key_id, &config.secret_access_key) { + (Some(ak), Some(sk)) => { + let static_provider = match config.security_token.as_deref() { + Some(token) => StaticCredentialProvider::with_security_token(ak, sk, token), + None => StaticCredentialProvider::new(ak, sk), + }; + + provider.push_front(static_provider) + } + _ => provider, + } +} + /// Backend for Huaweicloud OBS services. #[derive(Debug, Clone)] pub struct ObsBackend { @@ -480,3 +534,123 @@ impl Service for ObsBackend { ))) } } + +#[cfg(test)] +mod tests { + use std::collections::HashMap; + + use reqsign_core::Context; + use reqsign_core::ProvideCredential; + use reqsign_core::StaticEnv; + + use super::*; + + const AMBIENT_ENVS: [(&str, &str); 3] = [ + ("HUAWEI_CLOUD_ACCESS_KEY_ID", "env-access-key-id"), + ("HUAWEI_CLOUD_SECRET_ACCESS_KEY", "env-secret-access-key"), + ("HUAWEI_CLOUD_SECURITY_TOKEN", "env-security-token"), + ]; + + fn ambient_context() -> Context { + Context::new().with_env(StaticEnv { + home_dir: None, + envs: AMBIENT_ENVS + .into_iter() + .map(|(key, value)| (key.to_string(), value.to_string())) + .collect::<HashMap<_, _>>(), + }) + } + + fn static_config() -> ObsConfig { + ObsConfig { + access_key_id: Some("static-access-key-id".to_string()), + secret_access_key: Some("static-secret-access-key".to_string()), + security_token: Some("static-security-token".to_string()), + ..Default::default() + } + } + + #[tokio::test] + async fn default_provider_loads_ambient_credentials() { + let provider = credential_provider(&ObsConfig::default()); + + let credential = provider + .provide_credential(&ambient_context()) + .await + .unwrap() + .expect("ambient credentials must be loaded"); + + assert_eq!(credential.access_key_id, "env-access-key-id"); + assert_eq!( + credential.security_token.as_deref(), + Some("env-security-token") + ); + } + + #[tokio::test] + async fn disable_config_load_ignores_ambient_credentials() { + let provider = credential_provider(&ObsConfig { + disable_config_load: true, + ..Default::default() + }); + + let credential = provider + .provide_credential(&ambient_context()) + .await + .unwrap(); + + assert!(credential.is_none()); + } + + #[tokio::test] + async fn disable_config_load_keeps_explicit_credentials() { + let provider = credential_provider(&ObsConfig { + disable_config_load: true, + ..static_config() + }); + + let credential = provider + .provide_credential(&ambient_context()) + .await + .unwrap() + .expect("explicit static credentials must be used"); + + assert_eq!(credential.access_key_id, "static-access-key-id"); + assert_eq!(credential.secret_access_key, "static-secret-access-key"); + assert_eq!( + credential.security_token.as_deref(), + Some("static-security-token") + ); + } + + #[tokio::test] + async fn security_token_is_signed_into_request_headers() { + let config = ObsConfig { + disable_config_load: true, + ..static_config() + }; + let signer = Signer::new( + ambient_context(), + credential_provider(&config), + RequestSigner::new("example-bucket"), + ); + let (mut parts, _) = + http::Request::get("https://example-bucket.obs.cn-north-4.myhuaweicloud.com/test.txt") + .body(()) + .unwrap() + .into_parts(); + + signer.sign(&mut parts, None).await.unwrap(); + + assert_eq!( + parts.headers["x-obs-security-token"], + "static-security-token" + ); + assert!( + parts.headers[http::header::AUTHORIZATION] + .to_str() + .unwrap() + .starts_with("OBS static-access-key-id:") + ); + } +} diff --git a/core/services/obs/src/config.rs b/core/services/obs/src/config.rs index 654c433661..3e0dd4874e 100644 --- a/core/services/obs/src/config.rs +++ b/core/services/obs/src/config.rs @@ -35,8 +35,27 @@ pub struct ObsConfig { pub access_key_id: Option<String>, /// Secret access key for obs. pub secret_access_key: Option<String>, + /// Security token (a.k.a. session token) for obs. + /// + /// Temporary credentials sign with `access_key_id`, `secret_access_key` and + /// this token, and the signer attaches the token as the + /// `x-obs-security-token` header. + /// + /// If this field is not set, OpenDAL reads the token from the environment + /// variable `HUAWEI_CLOUD_SECURITY_TOKEN` (unless `disable_config_load` is + /// enabled). + pub security_token: Option<String>, /// Bucket for obs. pub bucket: Option<String>, + /// Disable config load so that opendal will not load config from + /// environment. + /// + /// For examples: + /// + /// - envs like `HUAWEI_CLOUD_ACCESS_KEY_ID` + pub disable_config_load: bool, + /// Skip signature will skip loading credentials and signing requests. + pub skip_signature: bool, /// Deprecated: OBS versioning capability is not controlled by service config. #[deprecated( since = "0.57.0", @@ -51,6 +70,11 @@ impl Debug for ObsConfig { .field("root", &self.root) .field("endpoint", &self.endpoint) .field("bucket", &self.bucket) + .field( + "security_token", + &self.security_token.as_ref().map(|_| "<redacted>"), + ) + .field("disable_config_load", &self.disable_config_load) .finish_non_exhaustive() } } @@ -83,6 +107,18 @@ mod tests { use opendal_core::Configurator; use opendal_core::OperatorUri; + #[test] + fn debug_redacts_security_token() { + let cfg = ObsConfig { + security_token: Some("super-secret-token".to_string()), + ..Default::default() + }; + + let debug = format!("{cfg:?}"); + assert!(!debug.contains("super-secret-token"), "{debug}"); + assert!(debug.contains("<redacted>"), "{debug}"); + } + #[test] fn from_uri_extracts_bucket_and_root() { let uri = OperatorUri::new( diff --git a/core/services/obs/src/core.rs b/core/services/obs/src/core.rs index eb529d03d2..c3c90e3402 100644 --- a/core/services/obs/src/core.rs +++ b/core/services/obs/src/core.rs @@ -46,6 +46,7 @@ pub struct ObsCore { pub bucket: String, pub root: String, pub endpoint: String, + pub skip_signature: bool, pub signer: Signer<Credential>, } @@ -71,6 +72,10 @@ impl ObsCore { } pub async fn sign<T>(&self, ctx: &OperationContext, req: Request<T>) -> Result<Request<T>> { + if self.skip_signature { + return Ok(req); + } + let (mut parts, body) = req.into_parts(); self.signer(ctx) @@ -87,6 +92,10 @@ impl ObsCore { req: Request<T>, duration: Duration, ) -> Result<Request<T>> { + if self.skip_signature { + return Ok(req); + } + let (mut parts, body) = req.into_parts(); self.signer(ctx) @@ -577,10 +586,116 @@ pub struct ListObjectsOutputContent { #[cfg(test)] mod tests { + use std::collections::HashMap; + use bytes::Buf; + use http::header::AUTHORIZATION; + use reqsign_core::Context; + use reqsign_core::StaticEnv; + use reqsign_huaweicloud_obs::DefaultCredentialProvider; + use reqsign_huaweicloud_obs::RequestSigner; + use reqsign_huaweicloud_obs::StaticCredentialProvider; use super::*; + /// Build a core whose signer only sees the given provider, so tests never + /// depend on the ambient process environment. + fn test_core(skip_signature: bool, provider: DefaultCredentialProvider) -> ObsCore { + let ctx = Context::new().with_env(StaticEnv { + home_dir: None, + envs: HashMap::new(), + }); + + ObsCore { + info: ServiceInfo::new(crate::OBS_SCHEME, "/", "example-bucket"), + capability: Capability::default(), + bucket: "example-bucket".to_string(), + root: "/".to_string(), + endpoint: "https://example-bucket.obs.cn-north-4.myhuaweicloud.com".to_string(), + skip_signature, + signer: Signer::new(ctx, provider, RequestSigner::new("example-bucket")), + } + } + + fn static_credential_provider() -> DefaultCredentialProvider { + DefaultCredentialProvider::builder() + .no_env() + .build() + .push_front(StaticCredentialProvider::with_security_token( + "access-key-id", + "secret-access-key", + "security-token", + )) + } + + fn empty_credential_provider() -> DefaultCredentialProvider { + DefaultCredentialProvider::builder().no_env().build() + } + + fn head_request(core: &ObsCore) -> Request<Buffer> { + core.obs_head_object_request("test.txt", &OpStat::default()) + .expect("head object request must build") + } + + #[tokio::test] + async fn signing_attaches_static_credentials() { + let core = test_core(false, static_credential_provider()); + + let req = core + .sign(&OperationContext::new(), head_request(&core)) + .await + .unwrap(); + + assert!( + req.headers()[AUTHORIZATION] + .to_str() + .unwrap() + .starts_with("OBS access-key-id:") + ); + assert_eq!(req.headers()["x-obs-security-token"], "security-token"); + } + + #[tokio::test] + async fn skip_signature_leaves_request_headers_unsigned() { + let core = test_core(true, static_credential_provider()); + + let req = core + .sign(&OperationContext::new(), head_request(&core)) + .await + .unwrap(); + + assert!(req.headers().get(AUTHORIZATION).is_none()); + assert!(req.headers().get("x-obs-security-token").is_none()); + } + + #[tokio::test] + async fn skip_signature_leaves_presigned_query_unsigned() { + let core = test_core(true, static_credential_provider()); + + let req = core + .sign_query( + &OperationContext::new(), + head_request(&core), + Duration::from_secs(3600), + ) + .await + .unwrap(); + + assert_eq!(req.uri().query(), None); + } + + #[tokio::test] + async fn skip_signature_accepts_requests_without_credentials() { + let core = test_core(true, empty_credential_provider()); + + let req = core + .sign(&OperationContext::new(), head_request(&core)) + .await + .unwrap(); + + assert!(req.headers().get(AUTHORIZATION).is_none()); + } + #[test] fn test_parse_xml() { let bs = bytes::Bytes::from( diff --git a/core/services/obs/src/docs.md b/core/services/obs/src/docs.md index bb2760184c..3716a3bb9b 100644 --- a/core/services/obs/src/docs.md +++ b/core/services/obs/src/docs.md @@ -21,6 +21,20 @@ Use [`crate::ObsConfig`] for serializable configuration and this builder's methods for direct construction. The field and method documentation defines accepted values, defaults, and environment interaction. +## Credentials + +OpenDAL resolves OBS credentials in this order: + +1. `access_key_id`, `secret_access_key`, and `security_token` set on the builder + or config. The signer attaches `security_token` as the `x-obs-security-token` + header when it is set. +2. `HUAWEI_CLOUD_ACCESS_KEY_ID`, `HUAWEI_CLOUD_SECRET_ACCESS_KEY`, and + `HUAWEI_CLOUD_SECURITY_TOKEN` loaded from the environment. + +[`crate::Obs::disable_config_load`] removes the environment step so that only +configured credentials are used. [`crate::Obs::skip_signature`] skips credential +loading and request signing, which sends requests without authentication. + ## Example ### Via Builder diff --git a/website/data/services.json b/website/data/services.json index e576fdf20d..95ca795755 100644 --- a/website/data/services.json +++ b/website/data/services.json @@ -3355,6 +3355,13 @@ "group": "General", "comments": "Secret access key for obs." }, + { + "name": "security_token", + "type": "string", + "required": false, + "group": "General", + "comments": "Security token (a.k.a. session token) for obs.\n\nTemporary credentials sign with `access_key_id`, `secret_access_key` and\nthis token, and the signer attaches the token as the\n`x-obs-security-token` header.\n\nIf this field is not set, OpenDAL reads the token from the environment\nvariable `HUAWEI_CLOUD_SECURITY_TOKEN` (unless `disable_config_load` is\nenabled)." + }, { "name": "bucket", "type": "string", @@ -3362,6 +3369,20 @@ "group": "General", "comments": "Bucket for obs." }, + { + "name": "disable_config_load", + "type": "bool", + "required": false, + "group": "General", + "comments": "Disable config load so that opendal will not load config from\nenvironment.\n\nFor examples:\n\n- envs like `HUAWEI_CLOUD_ACCESS_KEY_ID`" + }, + { + "name": "skip_signature", + "type": "bool", + "required": false, + "group": "General", + "comments": "Skip signature will skip loading credentials and signing requests." + }, { "name": "enable_versioning", "type": "bool", @@ -3379,37 +3400,37 @@ "binding": "rust", "language": "rust", "minimal": "use opendal::Operator;\n\nlet operator = Operator::via_iter(\"obs\", [\n])?;", - "full": "use opendal::Operator;\n\nlet operator = Operator::via_iter(\"obs\", [\n // Root for obs.\n // (\"root\".to_string(), \"...\".to_string()),\n\n // Endpoint for obs.\n // (\"endpoint\".to_string(), \"...\".to_string()),\n\n // Access key id for obs.\n // (\"access_key_id\".to_string(), \"...\".to_string()),\n\n // Secret access key for obs.\n // (\"secret_access_key\".to_string(), \"...\".to_string()),\n\n // Bucket for obs.\n // (\"bucket\ [...] + "full": "use opendal::Operator;\n\nlet operator = Operator::via_iter(\"obs\", [\n // Root for obs.\n // (\"root\".to_string(), \"...\".to_string()),\n\n // Endpoint for obs.\n // (\"endpoint\".to_string(), \"...\".to_string()),\n\n // Access key id for obs.\n // (\"access_key_id\".to_string(), \"...\".to_string()),\n\n // Secret access key for obs.\n // (\"secret_access_key\".to_string(), \"...\".to_string()),\n\n // Security token (a.k.a. session tok [...] }, { "binding": "java", "language": "java", "minimal": "import java.util.HashMap;\nimport java.util.Map;\nimport org.apache.opendal.Operator;\n\nMap<String, String> config = new HashMap<>();\nOperator operator = Operator.of(\"obs\", config);", - "full": "import java.util.HashMap;\nimport java.util.Map;\nimport org.apache.opendal.Operator;\n\nMap<String, String> config = new HashMap<>();\n// Root for obs.\n// config.put(\"root\", \"...\");\n\n// Endpoint for obs.\n// config.put(\"endpoint\", \"...\");\n\n// Access key id for obs.\n// config.put(\"access_key_id\", \"...\");\n\n// Secret access key for obs.\n// config.put(\"secret_access_key\", \"...\");\n\n// Bucket for obs.\n// config.put(\"bucket\", \"...\");\nOperator [...] + "full": "import java.util.HashMap;\nimport java.util.Map;\nimport org.apache.opendal.Operator;\n\nMap<String, String> config = new HashMap<>();\n// Root for obs.\n// config.put(\"root\", \"...\");\n\n// Endpoint for obs.\n// config.put(\"endpoint\", \"...\");\n\n// Access key id for obs.\n// config.put(\"access_key_id\", \"...\");\n\n// Secret access key for obs.\n// config.put(\"secret_access_key\", \"...\");\n\n// Security token (a.k.a. session token) for obs.\n//\n// Tempora [...] }, { "binding": "python", "language": "python", "minimal": "import opendal\n\noperator = opendal.Operator(\n \"obs\",\n)", - "full": "import opendal\n\noperator = opendal.Operator(\n \"obs\",\n # Root for obs.\n # root=\"...\",\n\n # Endpoint for obs.\n # endpoint=\"...\",\n\n # Access key id for obs.\n # access_key_id=\"...\",\n\n # Secret access key for obs.\n # secret_access_key=\"...\",\n\n # Bucket for obs.\n # bucket=\"...\",\n)" + "full": "import opendal\n\noperator = opendal.Operator(\n \"obs\",\n # Root for obs.\n # root=\"...\",\n\n # Endpoint for obs.\n # endpoint=\"...\",\n\n # Access key id for obs.\n # access_key_id=\"...\",\n\n # Secret access key for obs.\n # secret_access_key=\"...\",\n\n # Security token (a.k.a. session token) for obs.\n #\n # Temporary credentials sign with `access_key_id`, `secret_access_key` and\n # this token, and the signer attaches [...] }, { "binding": "nodejs", "language": "javascript", "minimal": "import { Operator } from \"opendal\";\n\nconst operator = new Operator(\"obs\", {\n});", - "full": "import { Operator } from \"opendal\";\n\nconst operator = new Operator(\"obs\", {\n // Root for obs.\n // root: \"...\",\n\n // Endpoint for obs.\n // endpoint: \"...\",\n\n // Access key id for obs.\n // access_key_id: \"...\",\n\n // Secret access key for obs.\n // secret_access_key: \"...\",\n\n // Bucket for obs.\n // bucket: \"...\",\n});" + "full": "import { Operator } from \"opendal\";\n\nconst operator = new Operator(\"obs\", {\n // Root for obs.\n // root: \"...\",\n\n // Endpoint for obs.\n // endpoint: \"...\",\n\n // Access key id for obs.\n // access_key_id: \"...\",\n\n // Secret access key for obs.\n // secret_access_key: \"...\",\n\n // Security token (a.k.a. session token) for obs.\n //\n // Temporary credentials sign with `access_key_id`, `secret_access_key` and\n // this token, and the sig [...] }, { "binding": "ruby", "language": "ruby", "minimal": "require \"opendal\"\n\noperator = OpenDal::Operator.new(\"obs\", {\n})", - "full": "require \"opendal\"\n\noperator = OpenDal::Operator.new(\"obs\", {\n # Root for obs.\n # \"root\" => \"...\",\n\n # Endpoint for obs.\n # \"endpoint\" => \"...\",\n\n # Access key id for obs.\n # \"access_key_id\" => \"...\",\n\n # Secret access key for obs.\n # \"secret_access_key\" => \"...\",\n\n # Bucket for obs.\n # \"bucket\" => \"...\",\n})" + "full": "require \"opendal\"\n\noperator = OpenDal::Operator.new(\"obs\", {\n # Root for obs.\n # \"root\" => \"...\",\n\n # Endpoint for obs.\n # \"endpoint\" => \"...\",\n\n # Access key id for obs.\n # \"access_key_id\" => \"...\",\n\n # Secret access key for obs.\n # \"secret_access_key\" => \"...\",\n\n # Security token (a.k.a. session token) for obs.\n #\n # Temporary credentials sign with `access_key_id`, `secret_access_key` and\n # this token, and the signer [...] }, { "binding": "go", "language": "go", "minimal": "import (\n\t\"github.com/apache/opendal-go-services/obs\"\n\topendal \"github.com/apache/opendal/bindings/go\"\n)\n\noperator, err := opendal.NewOperator(obs.Scheme, opendal.OperatorOptions{\n})", - "full": "import (\n\t\"github.com/apache/opendal-go-services/obs\"\n\topendal \"github.com/apache/opendal/bindings/go\"\n)\n\noperator, err := opendal.NewOperator(obs.Scheme, opendal.OperatorOptions{\n\t// Root for obs.\n\t// \"root\": \"...\",\n\n\t// Endpoint for obs.\n\t// \"endpoint\": \"...\",\n\n\t// Access key id for obs.\n\t// \"access_key_id\": \"...\",\n\n\t// Secret access key for obs.\n\t// \"secret_access_key\": \"...\",\n\n\t// Bucket for obs.\n\t// \"bucket\": \" [...] + "full": "import (\n\t\"github.com/apache/opendal-go-services/obs\"\n\topendal \"github.com/apache/opendal/bindings/go\"\n)\n\noperator, err := opendal.NewOperator(obs.Scheme, opendal.OperatorOptions{\n\t// Root for obs.\n\t// \"root\": \"...\",\n\n\t// Endpoint for obs.\n\t// \"endpoint\": \"...\",\n\n\t// Access key id for obs.\n\t// \"access_key_id\": \"...\",\n\n\t// Secret access key for obs.\n\t// \"secret_access_key\": \"...\",\n\n\t// Security token (a.k.a. session token [...] } ] },
