-- 1. バケット作成
oci os bucket list \
--compartment-id ocid1.compartment.oc1..000000000000000000000000000000000000000000000000000000000000
oci os bucket create \
--compartment-id ocid1.compartment.oc1..000000000000000000000000000000000000000000000000000000000000 \
--name bucket01 \
--auto-tiering Disabled \
--object-events-enabled false \
--public-access-type NoPublicAccess \
--storage-tier Standard \
--versioning Disabled
-- 2. テストオブジェクト作成
echo test01 > file01.txt
echo test02 > file02.txt
oci os object list \
--bucket-name bucket01
oci os object put \
--bucket-name bucket01 \
--file file01.txt \
--name file01.txt
oci os object put \
--bucket-name bucket01 \
--file file02.txt \
--name file02.txt
-- 3. 事前認証済リクエスト作成
oci os preauth-request list \
--bucket-name bucket01
oci os preauth-request create \
--access-type ObjectRead \
--bucket-name bucket01 \
--name pr01 \
--time-expires 2024-01-03T08:40:00Z \
--object-name file01.txt
-- 4. 動作確認
curl https://objectstorage.us-ashburn-1.oraclecloud.com/p/0000000000000000000000000000000000000000000000000000000000000000/n/111111111111/b/bucket01/o/file01.txt
-- 5. クリーンアップ
事前認証済リクエスト削除
oci os preauth-request list \
--bucket-name bucket01
oci os preauth-request delete \
--bucket-name bucket01 \
--par-id 0000000000000000000000000000000000000000000000000000000000000000:file01.txt \
--force
バケット削除
oci os bucket list \
--compartment-id ocid1.compartment.oc1..000000000000000000000000000000000000000000000000000000000000
oci os bucket delete \
--name bucket01 \
--empty \
--force