Class OssUploader

java.lang.Object
com.alibaba.dashscope.resources.oss.OssUploader

public final class OssUploader extends Object
OSS upload for local multimodal files (design J8, ported from 2.x OSSUtils): two-step flow — GET /uploads?action=getPolicy&model= fetches a short-lived policy certificate, then a multipart POST to the returned upload_host stores the file. The resulting reference is oss://<upload_dir>/<fileName>. Credentials ride on the 3.0 transport (auth interceptor); failures raise the 3.0 error family.
  • Constructor Details

  • Method Details

    • upload

      public String upload(String model, Path file, RequestOptions options)
      Upload one local file, fetching a fresh policy certificate.
    • certificate

      public OssUploader.Certificate certificate(String model, RequestOptions options)
      Fetch the policy certificate; public so a caller uploading several files for one request fetches it once and reuses it (2.x parity — validity is governed server-side).
    • uploadWithCertificate

      public String uploadWithCertificate(OssUploader.Certificate cert, Path file)
      Multipart POST the file to the certificate's upload host; returns the oss:// reference.