全部產品
Search
文件中心

Object Storage Service:presign(產生預簽名URL)

更新時間:May 31, 2025

presign用於產生對象的預簽名URL。

命令格式

ossutil presign oss://bucket[/prefix] [flags]

參數

類型

說明

-d, --dirs

/

返回目前的目錄下的檔案和子目錄,而非遞迴顯示所有子目錄下的所有檔案。

--encoding-type

string

輸入的對象名或檔案名稱的編碼方式。取值:url。

--end-with

string

按字母排序,返回設定值之前的對象,包含設定值。

--exclude

stringArray

路徑或檔案名稱的排除規則。

--exclude-from

stringArray

從規則檔案裡讀取排除規則。

--expires-date

Time

簽名URL到期時間點(預設值off)。

--expires-duration

Duration

簽名URL到期時間,預設值15m0s(15分鐘0秒),取值範圍1s~1w(1秒 ~1周)。

--files-from

stringArray

從檔案中讀取源檔案名稱列表,忽略空行或注釋行。

--files-from-raw

stringArray

從檔案中讀取源檔案名稱列表。

--filter

stringArray

路徑或檔案名稱過濾規則。

--filter-from

stringArray

從規則檔案讀取過濾規則。

-f, --force

/

強制操作,不進行詢問提示。

--include

stringArray

路徑或檔案名稱的包含規則。

--include-from

stringArray

從規則檔案裡讀取包含規則。

--limited-num

int

返回結果的最大個數。

--list-objects

/

使用ListObjects介面列舉對象。

--min-age

Duration

僅處理修改時間在指定時間間隔前的檔案,預設單位是秒,可以使用單位尾碼形式。例如 1h,表示1小時。

說明

--min-age 1h 表示僅處理修改時間在1小時前或更早的檔案。

--max-age

Duration

僅處理修改時間在指定時間間隔內的檔案,預設單位是秒,可以使用單位尾碼形式。例如 1h,表示1小時。

說明

--max-age 1h 表示僅處理修改時間在1小時內的檔案。

--min-mtime

Time

僅處理修改時間在指定時間之後的檔案,時間格式:UTC時間。例如2006-01-02T15:04:05。

說明

--min-mtime "2006-01-02T15:04:05" 表示僅處理在 2006 年 1 月 2 日 15:04:05 之後修改的檔案。

--max-mtime

Time

僅處理修改時間在指定時間之前的檔案,時間格式:UTC時間,例如 2006-01-02T15:04:05。

--max-size

SizeSuffix

限制傳輸的最大檔案大小,預設是位元組,或單位尾碼形式B|K|M|G|T|P,1K(KiB)=1024B。

--metadata-exclude

stringArray

對象中繼資料的排除規則。

--metadata-filter

stringArray

對象中繼資料過濾規則。

--metadata-filter-from

stringArray

從規則檔案讀取對象中繼資料過濾規則。

--metadata-include

stringArray

對象中繼資料的包含規則。

--min-size

SizeSuffix

限制傳輸的最小檔案大小,預設是位元組,或單位尾碼形式B|K|M|G|T|P,1K(KiB)=1024B。

--page-size

int

批量處理時分頁列舉的對象的最大值(預設值1000),取值範圍1~1000。

--query-param

stringArray

請求中的查詢參數。

-r, --recursive

/

遞迴進行操作。當指定該選項時,命令會對儲存空間下所有合格對象進行操作,否則只對路徑指定的對象進行操作。

--request-payer

string

請求的支付方式,如果為要求者付費模式,請設定該值。取值:requester。

--start-after

string

按字母排序,返回設定值之後的對象,不包含。

--traffic-limit

int

單串連頻寬節流設定。取值範圍:819200~838860800。

--version-id

string

對象的版本標識。

說明

關於支援的全域命令列選項,請參見支援的全域命令列選項

使用樣本

  • 對儲存空間examplebucket裡的example.txt 對象,產生預設有效期間為15分鐘的預簽名URL。

    ossutil presign oss://examplebucket/example.txt
  • 對儲存空間examplebucket裡的example.txt對象,產生有效期間為1小時的預簽名URL。

    ossutil presign oss://examplebucket/example.txt --expires-duration 1h
  • 對儲存空間examplebucket裡的example.txt對象,產生有效期間到2024-06-01T12:00:00(UTC)的預簽名URL。

    ossutil presign oss://examplebucket/example.txt --expires-date 2024-06-01T12:00:00
  • 對儲存空間examplebucket裡的example.txt對象,產生包含圖片處理參數的預簽名URL。

    ossutil presign oss://examplebucket/example.txt --query-param x-oss-process=image/resize,m_fixed,w_100,h_100/rotate,90
  • 對儲存空間examplebucket裡的example.txt對象,產生版本標識為123的預簽名URL。

    ossutil presign oss://examplebucket/example.txt --version-id 123
  • 對儲存空間examplebucket裡的folder目錄,批量產生預設有效期間為15分鐘的預簽名URL。

    ossutil presign oss://examplebucket/folder/ -r
  • 對儲存空間examplebucket裡的folder目錄下的尾碼為.txt的檔案,批量產生預設有效期間為15分鐘的預簽名URL。

    ossutil presign oss://examplebucket/folder/ -r --include "*.txt"