### Run the Example Source: https://github.com/apache/reqsign/blob/main/services/azure-storage/README.md Command to run the blob storage example. ```bash cargo run --example blob_storage ``` -------------------------------- ### Run the custom_signer example Source: https://github.com/apache/reqsign/blob/main/core/README.md Runs the custom_signer example from the examples directory to demonstrate implementing custom signing logic. ```bash cargo run --example custom_signer ``` -------------------------------- ### Quick Start: Sign a request with reqsign_core Source: https://github.com/apache/reqsign/blob/main/core/README.md Shows the minimal setup for signing requests with reqsign_core: create a default Context, build a Signer with a credential loader and request builder, then call sign on request parts. The example uses placeholder variables (credential_loader, request_builder, parts) and returns a Result via ?. ```rust use reqsign_core::{Context, Signer, ProvideCredential, SignRequest}; // Create a context with your implementations let ctx = Context::default(); // Create a signer with credential loader and request builder let signer = Signer::new(ctx, credential_loader, request_builder); // Sign your requests let mut parts = /* your request parts */; signer.sign(&mut parts, None).await?; ``` -------------------------------- ### Run Custom Client Example Source: https://github.com/apache/reqsign/blob/main/context/http-send-reqwest/README.md Command to run the custom_client example that demonstrates various configuration options. ```bash cargo run --example custom_client ``` -------------------------------- ### Bucket Operations (List, Get Info, Get Location) Source: https://github.com/apache/reqsign/blob/main/services/aliyun-oss/README.md Shows how to list objects in a bucket, list with query parameters (prefix and max-keys), get bucket information, and get bucket location. Each example uses a GET request with the appropriate query string. ```rust // List objects let req = http::Request::get("https://bucket.oss-cn-beijing.aliyuncs.com/") .body(())?; // List with parameters let req = http::Request::get("https://bucket.oss-cn-beijing.aliyuncs.com/?prefix=photos/&max-keys=100") .body(())?; // Get bucket info let req = http::Request::get("https://bucket.oss-cn-beijing.aliyuncs.com/?bucketInfo") .body(())?; // Get bucket location let req = http::Request::get("https://bucket.oss-cn-beijing.aliyuncs.com/?location") .body(())?; ``` -------------------------------- ### Run read_credentials Example Source: https://github.com/apache/reqsign/blob/main/context/file-read-tokio/README.md Runs the read_credentials example to read credential files. The example is located at examples/read_credentials.rs. ```bash cargo run --example read_credentials -- ~/.aws/credentials ``` -------------------------------- ### Run the OSS operations example Source: https://github.com/apache/reqsign/blob/main/services/aliyun-oss/README.md Run the example from the `examples/oss_operations.rs` file to see common OSS operations in action. ```bash cargo run --example oss_operations ``` -------------------------------- ### Quick Start: Sign a Request with Default Credentials Source: https://github.com/apache/reqsign/blob/main/services/azure-storage/README.md Shows the minimal setup to sign a request to Azure Blob Storage using the default credential chain. Requires the reqsign-azure-storage, reqsign-core, reqsign-file-read-tokio, and reqsign-http-send-reqwest crates. ```rust use anyhow::Result; use reqsign_azure_storage::{DefaultCredentialProvider, RequestSigner}; use reqsign_core::{Context, Signer}; use reqsign_file_read_tokio::TokioFileRead; use reqsign_http_send_reqwest::ReqwestHttpSend; #[tokio::main] async fn main() -> Result<()> { let ctx = Context::new() .with_file_read(TokioFileRead) .with_http_send(ReqwestHttpSend::default()); let signer = Signer::new( ctx, DefaultCredentialProvider::new(), RequestSigner::new(), ); let mut req = http::Request::get( "https://mystorageaccount.blob.core.windows.net/container/blob", ) .body(()) .unwrap() .into_parts() .0; signer.sign(&mut req, None).await?; Ok(()) } ``` -------------------------------- ### Run SSO Mock Server Source: https://github.com/apache/reqsign/blob/main/services/aws-v4/tests/mocks/README.md Starts the SSO mock server on a configurable port (default 8080). ```bash python3 sso_mock_server.py [port] # Default port: 8080 ``` -------------------------------- ### Aliyun OSS DefaultCredentialProvider builder example Source: https://github.com/apache/reqsign/blob/main/docs/default-credential-provider-api.md Configures an Aliyun OSS default credential provider with env explicitly set and OIDC removed. Expected slots are env and oidc. ```rust let provider = DefaultCredentialProvider::builder() .env(EnvCredentialProvider::new()) .no_oidc() .build(); ``` -------------------------------- ### Run Cognito Mock Server Source: https://github.com/apache/reqsign/blob/main/services/aws-v4/tests/mocks/README.md Starts the Cognito mock server on a configurable port (default 8443). ```bash python3 cognito_mock_server.py [port] # Default port: 8443 ``` -------------------------------- ### Quick Start: Create Context with ReqwestHttpSend Source: https://github.com/apache/reqsign/blob/main/context/http-send-reqwest/README.md Shows how to create a Context with ReqwestHttpSend using default configuration or a custom reqwest client. The custom client is built with a 30-second timeout. ```rust use reqsign_core::Context; use reqsign_http_send_reqwest::ReqwestHttpSend; // Use with default configuration let ctx = Context::new( file_reader, ReqwestHttpSend::default(), ); // Or with custom client configuration let client = reqwest::Client::builder() .timeout(std::time::Duration::from_secs(30)) .build() .unwrap(); let ctx = Context::new( file_reader, ReqwestHttpSend::new(client), ); ``` -------------------------------- ### Quick Start: Create Oracle Signer with DefaultCredentialProvider Source: https://github.com/apache/reqsign/blob/main/services/oracle/README.md Initializes a signer with the default Oracle credential provider and request signer. The provider reads OCI environment variables and the configuration file at ~/.oci/config, with OCI_CONFIG_FILE and OCI_PROFILE for overrides. The environment provider reads OCI_USER, OCI_TENANCY, OCI_KEY_FILE, and OCI_FINGERPRINT. ```rust use reqsign_core::{Context, OsEnv, Signer}; use reqsign_file_read_tokio::TokioFileRead; use reqsign_oracle::{DefaultCredentialProvider, RequestSigner}; let context = Context::new() .with_file_read(TokioFileRead) .with_env(OsEnv); let signer = Signer::new( context, DefaultCredentialProvider::new(), RequestSigner::new(), ); ``` -------------------------------- ### Sign Aliyun OSS request with DefaultCredentialProvider Source: https://github.com/apache/reqsign/blob/main/services/aliyun-oss/README.md Shows how to build a credential loader with all supported providers (assume_role, env, oss_profile, credentials_file, config_file, credentials_uri, ecs_ram_role, oidc) and sign a GET request to an Aliyun OSS bucket. Includes commented alternatives for static credentials and for opting into V2 or V4 signing with a region. Requires the reqsign_aliyun_oss, reqsign_core, reqsign_file_read_tokio, and reqsign_http_send_reqwest crates. ```rust use reqsign_aliyun_oss::{ AssumeRoleCredentialProvider, AssumeRoleWithOidcCredentialProvider, ConfigFileCredentialProvider, CredentialsFileCredentialProvider, CredentialsUriCredentialProvider, DefaultCredentialProvider, EcsRamRoleCredentialProvider, EnvCredentialProvider, OssProfileCredentialProvider, RequestSigner, SigningVersion, StaticCredentialProvider, }; use reqsign_core::{Context, Result, Signer}; use reqsign_file_read_tokio::TokioFileRead; use reqsign_http_send_reqwest::ReqwestHttpSend; #[tokio::main] async fn main() -> Result<()> { let ctx = Context::new() .with_file_read(TokioFileRead) .with_http_send(ReqwestHttpSend::default()); let loader = DefaultCredentialProvider::builder() .assume_role(AssumeRoleCredentialProvider::new()) .env(EnvCredentialProvider::new()) .oss_profile(OssProfileCredentialProvider::new()) .credentials_file(CredentialsFileCredentialProvider::new()) .config_file(ConfigFileCredentialProvider::new()) .credentials_uri(CredentialsUriCredentialProvider::new()) .ecs_ram_role(EcsRamRoleCredentialProvider::new()) .oidc(AssumeRoleWithOidcCredentialProvider::new()) .build(); // Or use static credentials: // let loader = StaticCredentialProvider::new( // "your-access-key-id", // "your-access-key-secret", // ); let signer = Signer::new(ctx, loader, RequestSigner::new("bucket")); // Or opt into V2/V4 signing: // let signer = Signer::new( // ctx, // loader, // RequestSigner::new("bucket").with_signing_version(SigningVersion::V2), // ); // // let signer = Signer::new( // ctx, // loader, // RequestSigner::new("bucket") // .with_region("cn-beijing") // .with_signing_version(SigningVersion::V4), // ); let mut req = http::Request::get("https://bucket.oss-cn-beijing.aliyuncs.com/object.txt") .body(()) .unwrap() .into_parts() .0; signer.sign(&mut req, None).await?; Ok(()) } ``` -------------------------------- ### Builder slot methods for env and profile Source: https://github.com/apache/reqsign/blob/main/docs/default-credential-provider-api.md Shows the two primary methods for each provider slot, using env and profile as examples: .env(provider) and .no_env(), and .profile(provider) and .no_profile(). ```rust .env(provider) .no_env() ``` ```rust .profile(provider) .no_profile() ``` -------------------------------- ### Object Operations (Get, Put, Delete, Copy) Source: https://github.com/apache/reqsign/blob/main/services/aliyun-oss/README.md Shows how to build HTTP requests for basic object operations: GET to retrieve an object, PUT to upload with a Content-Type header, DELETE to remove an object, and PUT with an x-oss-copy-source header to copy an object. The requests are constructed with the http crate and use the OSS endpoint format. ```rust // Get object let req = http::Request::get("https://bucket.oss-cn-beijing.aliyuncs.com/object.txt") .body(())?; // Put object let req = http::Request::put("https://bucket.oss-cn-beijing.aliyuncs.com/object.txt") .header("Content-Type", "text/plain") .body(content)?; // Delete object let req = http::Request::delete("https://bucket.oss-cn-beijing.aliyuncs.com/object.txt") .body(())?; // Copy object let req = http::Request::put("https://bucket.oss-cn-beijing.aliyuncs.com/new-object.txt") .header("x-oss-copy-source", "/source-bucket/source-object.txt") .body(())?; ``` -------------------------------- ### Run ECS Mock Server Source: https://github.com/apache/reqsign/blob/main/services/aws-v4/tests/mocks/README.md Starts the ECS mock server on a configurable port (default 51679). ```bash python3 ecs_mock_server.py [port] # Default port: 51679 ``` -------------------------------- ### Run IMDS Mock Server Source: https://github.com/apache/reqsign/blob/main/services/aws-v4/tests/mocks/README.md Starts the IMDS mock server on a configurable port (default 1338). ```bash python3 imds_mock_server.py [port] # Default port: 1338 ``` -------------------------------- ### AWS Config for Credential Process Helper Source: https://github.com/apache/reqsign/blob/main/services/aws-v4/tests/mocks/README.md Example AWS Config file entries that use the credential process helper for default and custom profiles. ```ini [default] credential_process = python3 /path/to/credential_process_helper.py [profile custom] credential_process = python3 /path/to/credential_process_helper.py --profile test ``` -------------------------------- ### Quick Start: Sign Google Cloud Storage requests Source: https://github.com/apache/reqsign/blob/main/services/google/README.md Initializes a reqsign signer for Google Cloud Storage using the default credential provider and the storage service. Requires the reqsign_core, reqsign_file_read_tokio, reqsign_google, and reqsign_http_send_reqwest crates. ```rust use reqsign_core::{Context, OsEnv, Signer}; use reqsign_file_read_tokio::TokioFileRead; use reqsign_google::{DefaultCredentialProvider, RequestSigner}; use reqsign_http_send_reqwest::ReqwestHttpSend; let context = Context::new() .with_file_read(TokioFileRead) .with_http_send(ReqwestHttpSend::default()) .with_env(OsEnv); let signer = Signer::new( context, DefaultCredentialProvider::new(), RequestSigner::new("storage"), ); ``` -------------------------------- ### Quick Start: Create Signer with DefaultCredentialProvider Source: https://github.com/apache/reqsign/blob/main/services/huaweicloud-obs/README.md Creates a Signer for Huawei Cloud OBS using the default credential provider, which reads HUAWEI_CLOUD_ACCESS_KEY_ID and HUAWEI_CLOUD_SECRET_ACCESS_KEY from the environment. The bucket name is passed to RequestSigner::new. ```rust use reqsign_core::{Context, OsEnv, Signer}; use reqsign_huaweicloud_obs::{DefaultCredentialProvider, RequestSigner}; let context = Context::new().with_env(OsEnv); let signer = Signer::new( context, DefaultCredentialProvider::new(), RequestSigner::new("bucket"), ); ``` -------------------------------- ### Tencent COS DefaultCredentialProvider builder example Source: https://github.com/apache/reqsign/blob/main/docs/default-credential-provider-api.md Configures a Tencent COS default credential provider with env disabled and web_identity set to AssumeRoleWithWebIdentityCredentialProvider. Expected slots are env and web_identity. ```rust let provider = DefaultCredentialProvider::builder() .no_env() .web_identity(AssumeRoleWithWebIdentityCredentialProvider::new()) .build(); ``` -------------------------------- ### Run cargo command on all targets Source: https://github.com/apache/reqsign/blob/main/CONTRIBUTING.md Run a cargo command (check, build, test, clippy) across all test, benchmark, and example targets. ```shell cargo --tests --benches --examples ``` -------------------------------- ### AWS V4 DefaultCredentialProvider builder example Source: https://github.com/apache/reqsign/blob/main/docs/default-credential-provider-api.md Configures an AWS V4 default credential provider with env disabled, profile set to 'prod', and IMDS disabled. Expected slots are env, profile, sso, web_identity, process, ecs, and imds. ```rust let provider = DefaultCredentialProvider::builder() .no_env() .profile(ProfileCredentialProvider::new().with_profile("prod")) .no_imds() .build(); ``` -------------------------------- ### Sign an S3 request with reqsign_aws_v4 Source: https://github.com/apache/reqsign/blob/main/services/aws-v4/README.md Sets up a signer with the default credential provider and an S3 request signer for the us-east-1 region, then signs a GET request to an S3 URL. Requires the tokio runtime and the listed reqsign crates. ```rust use reqsign_aws_v4::{DefaultCredentialProvider, RequestSigner}; use reqsign_core::{Context, OsEnv, Signer}; use reqsign_file_read_tokio::TokioFileRead; use reqsign_http_send_reqwest::ReqwestHttpSend; #[tokio::main] async fn main() -> anyhow::Result<()> { let ctx = Context::new() .with_file_read(TokioFileRead) .with_http_send(ReqwestHttpSend::default()) .with_env(OsEnv); let signer = Signer::new( ctx, DefaultCredentialProvider::new(), RequestSigner::new("s3", "us-east-1"), ); let mut req = http::Request::get("https://s3.amazonaws.com/mybucket/mykey") .body(()) .unwrap() .into_parts() .0; signer.sign(&mut req, None).await?; Ok(()) } ``` -------------------------------- ### Run all tests Source: https://github.com/apache/reqsign/blob/main/CONTRIBUTING.md Run all unit tests after copying .env.example to local and adjusting test suite values. ```shell cargo test ``` -------------------------------- ### Integration with Services: Create Context and Signer Source: https://github.com/apache/reqsign/blob/main/context/http-send-reqwest/README.md Shows how to create a Context with TokioFileRead and ReqwestHttpSend, then use it with a Signer for cloud service clients. ```rust use reqsign_core::{Context, Signer}; use reqsign_file_read_tokio::TokioFileRead; use reqsign_http_send_reqwest::ReqwestHttpSend; // Create context for cloud service clients let ctx = Context::new( TokioFileRead::default(), ReqwestHttpSend::default(), ); // Use with any reqsign service let signer = Signer::new(ctx, loader, builder); ``` -------------------------------- ### Run bootstrap-rust-crates.sh Source: https://github.com/apache/reqsign/blob/main/release/SKILL.md Run this command from a clean checkout of the apache/reqsign main branch to perform the bootstrap transition. It must be run without a second confirmation after a PMC release manager explicitly chooses the reservation time. Do not use it for release status checks or dry-run planning. ```bash release/scripts/bootstrap-rust-crates.sh ``` -------------------------------- ### Environment Variables for SAS Token Source: https://github.com/apache/reqsign/blob/main/services/azure-storage/README.md Sets the environment variable for a SAS token. The token is a query string starting with 'sv='. ```bash export AZURE_STORAGE_SAS_TOKEN="sv=2021-06-08&ss=b&srt=sco&sp=rwdlacx..." ``` -------------------------------- ### Product-level API methods for DefaultCredentialProvider Source: https://github.com/apache/reqsign/blob/main/docs/default-credential-provider-api.md Shows the uniform product-level API methods that every service-level default provider exposes: new(), builder(), with_chain(chain), push_front(provider), and the Default implementation. ```rust DefaultCredentialProvider::new() DefaultCredentialProvider::builder() DefaultCredentialProvider::with_chain(chain) DefaultCredentialProvider::push_front(provider) impl Default for DefaultCredentialProvider ``` -------------------------------- ### Sync live state for release Source: https://github.com/apache/reqsign/blob/main/release/SKILL.md Commands to fetch tags, check status, list remote tags, and verify source release artifacts on Apache dist. ```bash git fetch origin main --tags git status --short --branch git tag --list 'vX.Y.Z*' --sort=version:refname git ls-remote --tags origin 'refs/tags/vX.Y.Z*' svn ls https://dist.apache.org/repos/dist/dev/opendal/reqsign-X.Y.Z/ || true svn ls https://dist.apache.org/repos/dist/release/opendal/reqsign-X.Y.Z/ || true ``` -------------------------------- ### Run live tests with REQSIGN_GOOGLE_TEST_STATIC=on Source: https://github.com/apache/reqsign/blob/main/services/google/tests/README.md Runs live tests for the static provider by setting the gate variable to 'on' and providing required environment variables. The test command targets the 'credential_providers::static_provider::' tests with --no-capture. ```bash REQSIGN_GOOGLE_TEST_STATIC=on \ REQSIGN_GOOGLE_CREDENTIAL="$SERVICE_ACCOUNT_JSON_BASE64" \ REQSIGN_GOOGLE_CLOUD_STORAGE_SCOPE=https://www.googleapis.com/auth/devstorage.read_only \ REQSIGN_GOOGLE_CLOUD_STORAGE_PROBE_URL='https://storage.googleapis.com/storage/v1/b/reqsign/o/live%2Fcredential-ok?alt=media' \ cargo test -p reqsign-google --test main \ credential_providers::static_provider:: -- --no-capture ``` -------------------------------- ### Configuration Options: Build Custom Reqwest Client Source: https://github.com/apache/reqsign/blob/main/context/http-send-reqwest/README.md Demonstrates building a reqwest Client with various configuration options including timeouts, connection pooling, HTTP settings, proxy, and TLS settings, then wrapping it in ReqwestHttpSend. ```rust use reqwest::Client; use reqsign_http_send_reqwest::ReqwestHttpSend; let client = Client::builder() // Timeouts .timeout(Duration::from_secs(30)) .connect_timeout(Duration::from_secs(10)) // Connection pooling .pool_max_idle_per_host(10) .pool_idle_timeout(Duration::from_secs(90)) // HTTP settings .user_agent("my-app/1.0") .default_headers(headers) // Proxy configuration .proxy(reqwest::Proxy::https("https://proxy.example.com")?) // TLS configuration .danger_accept_invalid_certs(false) .min_tls_version(reqwest::tls::Version::TLS_1_2) .build()?; let http_send = ReqwestHttpSend::new(client); ``` -------------------------------- ### Multipart Upload (Initiate and Upload Part) Source: https://github.com/apache/reqsign/blob/main/services/aliyun-oss/README.md Shows how to initiate a multipart upload with a POST request to the object URL with ?uploads, and how to upload a part with a PUT request including partNumber and uploadId query parameters. The uploadId is typically obtained from the initiation response. ```rust // Initiate multipart upload let req = http::Request::post("https://bucket.oss-cn-beijing.aliyuncs.com/object.txt?uploads") .body(())?; // Upload part let req = http::Request::put("https://bucket.oss-cn-beijing.aliyuncs.com/object.txt?partNumber=1&uploadId=xxx") .body(part_data)?; ``` -------------------------------- ### Build Source Artifact Source: https://github.com/apache/reqsign/blob/main/release/SKILL.md Create a clean directory, archive the RC tag with git archive, sign and checksum the tarball, then verify the signature, checksum, and required files. The signing key must be present in Apache OpenDAL KEYS. ```bash rm -rf /tmp/reqsign-release-X.Y.Z mkdir -p /tmp/reqsign-release-X.Y.Z/dist git archive \ --format=tar.gz \ --prefix=apache-reqsign-X.Y.Z/ \ -o /tmp/reqsign-release-X.Y.Z/dist/apache-reqsign-X.Y.Z.tar.gz \ vX.Y.Z-rc.N cd /tmp/reqsign-release-X.Y.Z/dist gpg --armor --detach-sign apache-reqsign-X.Y.Z.tar.gz shasum -a 512 apache-reqsign-X.Y.Z.tar.gz > apache-reqsign-X.Y.Z.tar.gz.sha512 gpg --verify apache-reqsign-X.Y.Z.tar.gz.asc apache-reqsign-X.Y.Z.tar.gz shasum -a 512 -c apache-reqsign-X.Y.Z.tar.gz.sha512 tar -tzf apache-reqsign-X.Y.Z.tar.gz | rg '(^|/)LICENSE$|(^|/)NOTICE$|(^|/)Cargo.toml$' ``` ```bash svn cat https://dist.apache.org/repos/dist/release/opendal/KEYS | rg 'xuanwo@apache.org|Xuanwo|KEY_FINGERPRINT' ``` -------------------------------- ### Create Context with TokioFileRead and Read File Source: https://github.com/apache/reqsign/blob/main/context/file-read-tokio/README.md Shows how to create a Context with TokioFileRead and read a file asynchronously. Requires an HTTP client and a Tokio runtime with the fs feature enabled. ```rust use reqsign_core::Context; use reqsign_file_read_tokio::TokioFileRead; // Create a context with Tokio file reader let ctx = Context::new( TokioFileRead::default(), http_client, // Your HTTP client ); // Read files asynchronously let content = ctx.file_read("/path/to/file").await?; ``` -------------------------------- ### Use default AWS signer to sign an S3 request Source: https://github.com/apache/reqsign/blob/main/README.md Use the default signer for AWS S3 to sign a GET request. The signer automatically loads credentials from environment variables, config files, or IAM roles, and sets up the default HTTP client and file reader. This is the recommended way to use reqsign. ```rust use anyhow::Result; use reqsign::aws; #[tokio::main] async fn main() -> Result<()> { // Create a default signer for S3 in us-east-1 // This will automatically: // - Load credentials from environment variables, config files, or IAM roles // - Set up the default HTTP client and file reader let signer = aws::default_signer("s3", "us-east-1"); // Build your request let mut req = http::Request::builder() .method("GET") .uri("https://s3.amazonaws.com/testbucket") .body(()) .unwrap() .into_parts() .0; // Sign the request signer.sign(&mut req, None).await?; // Send the request with your preferred HTTP client println!("Request has been signed!"); Ok(()) } ``` -------------------------------- ### OSS Profile File Configuration Source: https://github.com/apache/reqsign/blob/main/services/aliyun-oss/README.md Configuration file at ~/.oss/credentials with default and prod profiles. Override file path with OSS_CREDENTIAL_PROFILES_FILE and profile with OSS_PROFILE. ```ini [default] access_key_id = your-access-key-id access_key_secret = your-access-key-secret session_token = optional-session-token [prod] access_key_id = prod-access-key-id access_key_secret = prod-access-key-secret ``` -------------------------------- ### Validate publish plan and packages Source: https://github.com/apache/reqsign/blob/main/release/SKILL.md Run unit tests, generate the publish plan, and dry-run publish to validate the release plan. ```bash python3 -m unittest discover \ -s .github/scripts/release_rust \ -p "test_*.py" python3 .github/scripts/release_rust/plan.py cargo publish --workspace --dry-run --allow-dirty ``` -------------------------------- ### Create Aliyun OSS signer Source: https://github.com/apache/reqsign/blob/main/README.md Create a default signer for Aliyun OSS. The signer uses default credential resolution. ```rust use reqsign::aliyun; // Default signer for Aliyun OSS let signer = aliyun::default_signer(); ``` -------------------------------- ### Upload RC Artifacts Source: https://github.com/apache/reqsign/blob/main/release/SKILL.md Check out the empty dev dist directory, copy the built artifacts, commit with svn, and verify the remote copy by checking out and validating checksums and signatures. ```bash rm -rf /tmp/opendal-dist-dev-reqsign-X.Y.Z svn co --depth=empty https://dist.apache.org/repos/dist/dev/opendal /tmp/opendal-dist-dev-reqsign-X.Y.Z cd /tmp/opendal-dist-dev-reqsign-X.Y.Z mkdir reqsign-X.Y.Z cp /tmp/reqsign-release-X.Y.Z/dist/* reqsign-X.Y.Z/ svn add reqsign-X.Y.Z svn status svn commit --force-interactive -m "Prepare reqsign X.Y.Z release candidate" ``` ```bash svn ls https://dist.apache.org/repos/dist/dev/opendal/reqsign-X.Y.Z/ rm -rf /tmp/reqsign-verify-X.Y.Z svn co https://dist.apache.org/repos/dist/dev/opendal/reqsign-X.Y.Z /tmp/reqsign-verify-X.Y.Z cd /tmp/reqsign-verify-X.Y.Z shasum -a 512 -c apache-reqsign-X.Y.Z.tar.gz.sha512 gpg --verify apache-reqsign-X.Y.Z.tar.gz.asc apache-reqsign-X.Y.Z.tar.gz ``` -------------------------------- ### Use Specific Credential Providers Directly Source: https://github.com/apache/reqsign/blob/main/services/azure-storage/README.md Shows how to use a single provider directly instead of the default chain. Both environment and static shared key providers are shown. ```rust use reqsign_azure_storage::{EnvCredentialProvider, StaticCredentialProvider}; let env_provider = EnvCredentialProvider::new(); let static_provider = StaticCredentialProvider::new_shared_key( "mystorageaccount", "base64encodedkey==", ); ``` -------------------------------- ### Create RC Tag Source: https://github.com/apache/reqsign/blob/main/release/SKILL.md Fetch the latest main, detach HEAD, create a signed tag, verify it, and push. Confirm the bootstrap workflow succeeded and no later commit added another crate before tagging. ```bash git fetch origin main --tags git switch --detach origin/main git tag -s vX.Y.Z-rc.N -m "vX.Y.Z-rc.N" git tag -v vX.Y.Z-rc.N git push origin vX.Y.Z-rc.N ``` -------------------------------- ### Run Credential Process Helper Source: https://github.com/apache/reqsign/blob/main/services/aws-v4/tests/mocks/README.md Runs the credential process helper script, optionally with a profile name. ```bash python3 credential_process_helper.py [--profile ] ``` -------------------------------- ### Select a profile with DefaultCredentialProvider::builder() Source: https://github.com/apache/reqsign/blob/main/services/aws-v4/README.md Builds a default credential provider that consistently uses the 'production' profile for shared profile, SSO, and process credential sources. The explicit selection takes precedence over AWS_PROFILE. ```rust use reqsign_aws_v4::DefaultCredentialProvider; let provider = DefaultCredentialProvider::builder() .with_profile("production") .build(); ``` -------------------------------- ### Build and Test Commands Source: https://github.com/apache/reqsign/blob/main/AGENTS.md Commands for formatting, linting, and testing the Rust workspace. Run these in the repository root to verify code quality and execute unit and doc tests. ```bash cargo fmt --all -- --check cargo clippy --workspace --all-targets --all-features -- -D warnings cargo test --no-fail-fast # unit tests cargo test --doc --all-features --workspace # doc tests ``` -------------------------------- ### Create a Volcengine TOS signer with DefaultCredentialProvider Source: https://github.com/apache/reqsign/blob/main/services/volcengine-tos/README.md Initializes a signer for Volcengine Object Storage using the default credential provider, which reads credentials from the environment. Requires setting VOLCENGINE_ACCESS_KEY_ID and VOLCENGINE_SECRET_ACCESS_KEY, and optionally VOLCENGINE_SESSION_TOKEN. Use StaticCredentialProvider when credentials are supplied directly by an application. ```rust use reqsign_core::{Context, OsEnv, Signer}; use reqsign_volcengine_tos::{DefaultCredentialProvider, RequestSigner}; let context = Context::new().with_env(OsEnv); let signer = Signer::new( context, DefaultCredentialProvider::new(), RequestSigner::new("cn-beijing"), ); ``` -------------------------------- ### Run cargo check, build, clippy, test, and bench Source: https://github.com/apache/reqsign/blob/main/CONTRIBUTING.md Basic cargo commands for analyzing, compiling, linting, testing, and benchmarking the Rust project. ```shell cargo check ``` ```shell cargo build ``` ```shell cargo clippy ``` ```shell cargo test ``` ```shell cargo bench ``` -------------------------------- ### Opt into V2 signing with RequestSigner::with_signing_version Source: https://github.com/apache/reqsign/blob/main/services/aliyun-oss/README.md Use this snippet to configure the Aliyun OSS request signer to use V2 signing. The default is V1, so this explicitly opts into V2. ```rust use reqsign_aliyun_oss::{RequestSigner, SigningVersion}; let signer = RequestSigner::new("bucket").with_signing_version(SigningVersion::V2); ``` -------------------------------- ### Run deterministic tests with cargo test Source: https://github.com/apache/reqsign/blob/main/services/google/tests/README.md Runs the deterministic tests and response replays for the reqsign Google provider. Use this command to verify the library without hitting live Google endpoints. ```bash cargo test -p reqsign-google --lib --tests --all-features --no-fail-fast ``` -------------------------------- ### Opt into V4 signing with region and signing version Source: https://github.com/apache/reqsign/blob/main/services/aliyun-oss/README.md Use this snippet to configure the Aliyun OSS request signer for V4 signing. It requires setting both the region and the signing version. The region is a no-op for V1 signing. ```rust use reqsign_aliyun_oss::{RequestSigner, SigningVersion}; let signer = RequestSigner::new("bucket") .with_region("cn-beijing") .with_signing_version(SigningVersion::V4); ``` -------------------------------- ### Builder API methods for DefaultCredentialProviderBuilder Source: https://github.com/apache/reqsign/blob/main/docs/default-credential-provider-api.md Shows the builder methods that every DefaultCredentialProviderBuilder exposes: new(), default(), and build(). ```rust DefaultCredentialProviderBuilder::new() DefaultCredentialProviderBuilder::default() .build() ``` -------------------------------- ### Alibaba CLI Config File Configuration Source: https://github.com/apache/reqsign/blob/main/services/aliyun-oss/README.md Configuration file at ~/.aliyun/config.json. Supports AK and StsToken modes. Override with ALIBABA_CLOUD_CONFIG_FILE and ALIBABA_CLOUD_PROFILE. ```json { "current": "default", "profiles": [ { "name": "default", "mode": "AK", "access_key_id": "your-access-key-id", "access_key_secret": "your-access-key-secret" } ] } ``` -------------------------------- ### Create default signers for other cloud services Source: https://github.com/apache/reqsign/blob/main/reqsign/README.md Shows how to create default signers for Azure Storage, Google Cloud, Aliyun OSS, Huawei Cloud OBS, Tencent COS, and Oracle Cloud. Each service has its own module and default_signer function, with some requiring a bucket or endpoint argument. ```rust // Azure Storage use reqsign::azure; let signer = azure::default_signer(); // Google Cloud use reqsign::google; let signer = google::default_signer("storage.googleapis.com"); // Aliyun OSS use reqsign::aliyun; let signer = aliyun::default_signer("mybucket"); // Huawei Cloud OBS use reqsign::huaweicloud; let signer = huaweicloud::default_signer("mybucket"); // Tencent COS use reqsign::tencent; let signer = tencent::default_signer(); // Oracle Cloud use reqsign::oracle; let signer = oracle::default_signer(); ``` -------------------------------- ### Run a live Azure CLI credential provider test Source: https://github.com/apache/reqsign/blob/main/services/azure-storage/tests/README.md Command to run a live test for the Azure CLI credential provider, requiring specific environment variables and a probe script. ```bash REQSIGN_AZURE_STORAGE_TEST_CLI=on \ AZURE_STORAGE_ACCOUNT=example \ AZURE_STORAGE_CONTAINER=container \ bash .github/azure-live-tests/with-probe.sh cargo test -p reqsign-azure-storage --test main \ credential_providers::azure_cli::test_azure_cli_provider -- --exact ``` -------------------------------- ### Builder slot methods for sso and imds Source: https://github.com/apache/reqsign/blob/main/docs/default-credential-provider-api.md Shows the same pattern for the sso and imds slots: .sso(provider) and .no_sso(), and .imds(provider) and .no_imds(). ```rust .sso(provider) .no_sso() ``` ```rust .imds(provider) .no_imds() ``` -------------------------------- ### Environment Variables for Client Secret Source: https://github.com/apache/reqsign/blob/main/services/azure-storage/README.md Sets the environment variables for client secret authentication. Requires tenant ID, client ID, and client secret. ```bash export AZURE_TENANT_ID=tenant-id export AZURE_CLIENT_ID=client-id export AZURE_CLIENT_SECRET=client-secret ``` -------------------------------- ### Customize Default Credential Chain with Builder Source: https://github.com/apache/reqsign/blob/main/services/azure-storage/README.md Shows how to customize the default credential chain using the builder pattern, disabling environment and IMDS providers and adding a client secret provider. Requires a tenant ID. ```rust use reqsign_azure_storage::{ ClientSecretCredentialProvider, DefaultCredentialProvider, }; let provider = DefaultCredentialProvider::builder() .no_env() .client_secret( ClientSecretCredentialProvider::new().with_tenant_id("tenant-id"), ) .no_imds() .build(); ``` -------------------------------- ### Environment Variables for Aliyun OSS Credentials Source: https://github.com/apache/reqsign/blob/main/services/aliyun-oss/README.md Set Aliyun OSS credentials via environment variables. Includes optional STS token and aliases for OSS-specific variables. ```bash export ALIBABA_CLOUD_ACCESS_KEY_ID=your-access-key-id export ALIBABA_CLOUD_ACCESS_KEY_SECRET=your-access-key-secret export ALIBABA_CLOUD_SECURITY_TOKEN=your-sts-token # Optional export OSS_ACCESS_KEY_ID=your-access-key-id # Alias export OSS_ACCESS_KEY_SECRET=your-access-key-secret # Alias export OSS_SESSION_TOKEN=your-sts-token # Alias ``` -------------------------------- ### Configure TokioCommandExecute in reqsign context Source: https://github.com/apache/reqsign/blob/main/context/command-execute-tokio/README.md Use this snippet to configure a reqsign context with Tokio-based command execution for credential providers that invoke external programs. It requires the reqsign_command_execute_tokio and reqsign_core crates. Command execution is supported on native targets; on WebAssembly targets it returns an unsupported-operation error. ```rust use reqsign_command_execute_tokio::TokioCommandExecute; use reqsign_core::Context; let context = Context::new().with_command_execute(TokioCommandExecute); ``` -------------------------------- ### Signer::new Source: https://github.com/apache/reqsign/blob/main/services/google/README.md Demonstrates how to create a signer for Google Cloud requests using the default credential provider and a request signer. ```APIDOC ## [Rust] Signer::new ### Description Creates a new signer for Google Cloud requests using the provided context, default credential provider, and request signer. ### Method Constructor ### Parameters - `context` (Context) - Required - The context containing file read, HTTP send, and environment implementations. - `DefaultCredentialProvider::new()` - Required - The default credential provider that follows the Application Default Credentials chain. - `RequestSigner::new("storage")` - Required - The request signer configured for the Google Cloud service (e.g., "storage"). ### Request Example ```rust use reqsign_core::{Context, OsEnv, Signer}; use reqsign_file_read_tokio::TokioFileRead; use reqsign_google::{DefaultCredentialProvider, RequestSigner}; use reqsign_http_send_reqwest::ReqwestHttpSend; let context = Context::new() .with_file_read(TokioFileRead) .with_http_send(ReqwestHttpSend::default()) .with_env(OsEnv); let signer = Signer::new( context, DefaultCredentialProvider::new(), RequestSigner::new("storage"), ); ``` ### Response Returns a `Signer` instance configured for signing Google Cloud requests. ``` -------------------------------- ### Alibaba Shared Credentials File Configuration Source: https://github.com/apache/reqsign/blob/main/services/aliyun-oss/README.md Configuration file at ~/.alibabacloud/credentials.ini with fallback to ~/.aliyun/credentials.ini. Supports access_key and sts_token types. Override with ALIBABA_CLOUD_CREDENTIALS_FILE and ALIBABA_CLOUD_PROFILE. ```ini [default] enable = true type = access_key access_key_id = your-access-key-id access_key_secret = your-access-key-secret [prod] enable = true type = sts_token access_key_id = prod-access-key-id access_key_secret = prod-access-key-secret sts_token = optional-session-token ``` -------------------------------- ### Verify crates.io versions Source: https://github.com/apache/reqsign/blob/main/release/SKILL.md Loop that checks the published versions of all reqsign crates on crates.io. Replace the crate list if needed. ```bash for c in \ reqsign reqsign-core reqsign-aliyun-oss reqsign-aws-core reqsign-aws-v4 \ reqsign-aws-v4a reqsign-azure-storage \ reqsign-command-execute-tokio reqsign-file-read-tokio reqsign-google \ reqsign-http-send-reqwest reqsign-huaweicloud-obs reqsign-oracle \ reqsign-tencent-cos reqsign-volcengine-tos do cargo info "$c" --registry crates-io | sed -n '1,4p' done ``` -------------------------------- ### Integrate TokioFileRead with ReqwestHttpSend and Signer Source: https://github.com/apache/reqsign/blob/main/context/file-read-tokio/README.md Integrates TokioFileRead with ReqwestHttpSend to create a Context and Signer for services needing file access. Requires a Tokio runtime with the fs feature enabled. ```rust use reqsign_core::{Context, Signer}; use reqsign_file_read_tokio::TokioFileRead; use reqsign_http_send_reqwest::ReqwestHttpSend; // Create context with Tokio file reader let ctx = Context::new( TokioFileRead::default(), ReqwestHttpSend::default(), ); // Use with any service that needs file access let signer = Signer::new(ctx, loader, builder); ``` -------------------------------- ### Initialize Tencent COS signer Source: https://github.com/apache/reqsign/blob/main/services/tencent-cos/README.md Initializes a signer with the default credential provider and request signer for Tencent Cloud Object Storage. The context uses environment variables for credentials. ```rust use reqsign_core::{Context, OsEnv, Signer}; use reqsign_tencent_cos::{DefaultCredentialProvider, RequestSigner}; let context = Context::new().with_env(OsEnv); let signer = Signer::new( context, DefaultCredentialProvider::new(), RequestSigner::new(), ); ``` -------------------------------- ### Set environment variables for credential provider tests Source: https://github.com/apache/reqsign/blob/main/services/aws-v4/tests/README.md Environment variables for enabling and configuring each credential provider test. Each provider has its own enable flag and may require additional variables or configuration files. ```bash # EnvCredentialProvider export REQSIGN_AWS_V4_TEST_ENV=on export AWS_ACCESS_KEY_ID=your_key export AWS_SECRET_ACCESS_KEY=your_secret # ProfileCredentialProvider export REQSIGN_AWS_V4_TEST_PROFILE=on # Requires ~/.aws/credentials and ~/.aws/config # AssumeRoleCredentialProvider export REQSIGN_AWS_V4_TEST_ASSUME_ROLE=on export REQSIGN_AWS_V4_ASSUME_ROLE_ARN=arn:aws:iam::123456789012:role/TestRole # Also needs base credentials (AWS_ACCESS_KEY_ID, etc.) # AssumeRoleWithWebIdentityCredentialProvider export REQSIGN_AWS_V4_TEST_WEB_IDENTITY=on export AWS_ROLE_ARN=arn:aws:iam::123456789012:role/WebIdentityRole export AWS_WEB_IDENTITY_TOKEN_FILE=/path/to/token # IMDSv2CredentialProvider (EC2 only) export REQSIGN_AWS_V4_TEST_IMDS=on # ECSCredentialProvider (ECS only) export REQSIGN_AWS_V4_TEST_ECS=on # SSOCredentialProvider export REQSIGN_AWS_V4_TEST_SSO=on # Requires SSO configuration in AWS profile # ProcessCredentialProvider export REQSIGN_AWS_V4_TEST_PROCESS=on # Requires credential_process in AWS config # CognitoIdentityCredentialProvider export REQSIGN_AWS_V4_TEST_COGNITO=on export REQSIGN_AWS_V4_COGNITO_IDENTITY_POOL_ID=us-east-1:xxxxx ``` -------------------------------- ### Grant a Service SAS with Shared Key Source: https://github.com/apache/reqsign/blob/main/services/azure-storage/README.md Shows how to mint a service SAS for a blob using a shared key. The account must match the shared key source. The returned credential can be supplied to the Azure RequestSigner. ```rust use std::time::Duration; use reqsign_azure_storage::{ ServiceSasBlobPermissions, ServiceSasConfig, ServiceSasGrant, ServiceSasGranter, StaticCredentialProvider, }; use reqsign_core::{Context, Granter}; # async fn example() -> reqsign_core::Result<()> { let grant = ServiceSasGrant::for_blob( "customer-data", "reports/current.csv", ServiceSasBlobPermissions::READ, ); let credential = Granter::new( Context::new(), StaticCredentialProvider::new_shared_key( "mystorageaccount", "", ), ServiceSasGranter::new(ServiceSasConfig::new("mystorageaccount"), grant), ) .grant(Some(Duration::from_secs(900))) .await?; # let _ = credential; # Ok(()) # } ``` -------------------------------- ### Create Azure Storage signer with default or static credentials Source: https://github.com/apache/reqsign/blob/main/README.md Create a default signer for Azure Storage, and optionally customize it with static credentials using StaticCredentialProvider. The default signer uses default credential resolution. ```rust use reqsign::azure; // Default signer for Azure Storage let signer = azure::default_signer(); // With custom credentials use reqsign_azure_storage::StaticCredentialProvider; let signer = azure::default_signer() .with_credential_provider(StaticCredentialProvider::new( "account-name", "account-key", )); ``` -------------------------------- ### Create Google Cloud Storage signer Source: https://github.com/apache/reqsign/blob/main/README.md Create a default signer for Google Cloud Storage by passing the service endpoint (e.g., "storage.googleapis.com"). ```rust use reqsign::google; // Default signer for Google Cloud Storage let signer = google::default_signer("storage.googleapis.com"); ``` -------------------------------- ### Customize default signer with with_credential_provider and with_context Source: https://github.com/apache/reqsign/blob/main/reqsign/README.md Customizes a default signer by replacing its credential provider with a StaticCredentialProvider and its context with a custom one. The StaticCredentialProvider takes an access key, secret key, and an optional session token. ```rust use reqsign::aws; use reqsign::aws::StaticCredentialProvider; // Start with default signer and customize components let signer = aws::default_signer("s3", "us-east-1") .with_credential_provider(StaticCredentialProvider::new( "my-access-key", "my-secret-key", None, // Optional session token )) .with_context(my_custom_context); ``` -------------------------------- ### Run local tests without Azure credentials Source: https://github.com/apache/reqsign/blob/main/services/azure-storage/tests/README.md Command to run the deterministic test suite without requiring Azure credentials. ```bash cargo test -p reqsign-azure-storage --lib --tests --no-fail-fast ``` -------------------------------- ### Test directory structure Source: https://github.com/apache/reqsign/blob/main/services/azure-storage/tests/README.md Shows the layout of the tests directory, including credential provider tests, fixtures, and signing tests. ```text tests/ ├── credential_providers/ # Live tests for every credential provider │ ├── static_provider.rs │ ├── env.rs │ ├── default.rs │ ├── imds.rs │ ├── workload_identity.rs │ ├── client_secret.rs │ ├── client_certificate.rs │ ├── azure_cli.rs │ └── azure_pipelines.rs ├── fixtures/ # Sanitized responses captured from Azure │ ├── entra_token_response.json │ ├── azure_cli_token_response.json │ └── imds_token_response.json └── signing/ # Shared Key and SAS signing tests ``` -------------------------------- ### Environment Variables for Shared Key Source: https://github.com/apache/reqsign/blob/main/services/azure-storage/README.md Sets the environment variables required for shared key authentication. The account key must be base64-encoded. ```bash export AZURE_STORAGE_ACCOUNT_NAME=mystorageaccount export AZURE_STORAGE_ACCOUNT_KEY=base64encodedkey== ``` -------------------------------- ### Internal endpoint for Aliyun VPC Source: https://github.com/apache/reqsign/blob/main/services/aliyun-oss/README.md Use the internal endpoint when your service runs within Aliyun VPC for better performance. ```rust // For better performance within Aliyun VPC "https://bucket.oss-cn-beijing-internal.aliyuncs.com" ``` -------------------------------- ### STS AssumeRole with Base AK Credentials Source: https://github.com/apache/reqsign/blob/main/services/aliyun-oss/README.md Configure DefaultCredentialProvider with AssumeRole using an explicit static base provider. Disables other sources and sets role ARN and session name. Alternatively, rely on default static base chain via ALIBABA_CLOUD_ACCESS_KEY_ID, ALIBABA_CLOUD_ACCESS_KEY_SECRET, ALIBABA_CLOUD_ROLE_ARN, and optionally ALIBABA_CLOUD_EXTERNAL_ID. ```rust use reqsign_aliyun_oss::{ AssumeRoleCredentialProvider, DefaultCredentialProvider, StaticCredentialProvider, }; // Use an explicit base access key source to call STS AssumeRole. let loader = DefaultCredentialProvider::builder() .no_env() .no_oss_profile() .no_credentials_file() .no_config_file() .assume_role( AssumeRoleCredentialProvider::new() .with_base_provider(StaticCredentialProvider::new( "your-access-key-id", "your-access-key-secret", )) .with_role_arn("acs:ram::123456789012:role/example") .with_role_session_name("my-session"), ) .no_oidc() .build(); ```