Sistem bantuan bawaan ossutil memungkinkan Anda mencari sintaks perintah, flag, dan contoh langsung di terminal.
Perintah bantuan bawaan
Tambahkan -h atau --help ke akhir perintah apa pun untuk melihat teks bantuannya. Gunakan ossutil [topic] untuk membaca bantuan mengenai topik tertentu.
| Deskripsi | Perintah |
|---|---|
| Menampilkan daftar semua perintah yang tersedia | ossutil -h |
Menampilkan bantuan untuk perintah cp | ossutil cp -h |
Menampilkan daftar semua subperintah dalam set perintah api | ossutil api -h |
Menampilkan bantuan untuk subperintah api put-bucket-cors | ossutil api put-bucket-cors -h |
Menampilkan bantuan untuk topik filter | ossutil filter |
Referensi bantuan perintah
Perintah ossutil terbagi menjadi dua kategori:
Perintah induk — perintah tingkat atas yang mengelompokkan subperintah terkait (misalnya,
api,cp,ls)Subperintah — perintah yang menjalankan aksi spesifik dan tidak memiliki subperintah lebih lanjut (misalnya,
api put-bucket-cors,cat)
Perintah induk
Bantuan untuk perintah induk mencakup lima bagian:
| Bagian | Informasi yang diberikan |
|---|---|
| Deskripsi | Fungsi perintah induk tersebut |
| Penggunaan | Pola sintaks perintah |
| Perintah yang tersedia | Semua subperintah yang dikelompokkan di bawah perintah induk ini |
| Topik bantuan tambahan | Topik tambahan yang dapat dieksplorasi dengan ossutil [topic] |
| Informasi bantuan lainnya | Baris referensi tambahan, seperti cara mendapatkan bantuan untuk perintah atau topik tertentu |
Contoh: ossutil -h
ossutil adalah alat untuk mengelola data OSS (Layanan Penyimpanan Objek).
Penggunaan: ossutil [perintah]
Perintah yang Tersedia:
api Perintah tingkat API
append Menambahkan konten ke objek yang dapat ditambahkan
cat Menggabungkan objek ke keluaran standar
config Membuat berkas konfigurasi dan menyimpan pengaturan konfigurasi serta kredensial
cp Mengunggah, Mengunduh, atau Menyalin Objek
du Mendapatkan ukuran penyimpanan bucket atau awalan (direktori) yang ditentukan
hash Mendapatkan nilai hash berkas
help Bantuan tentang perintah apa pun
ls Mendaftar bucket atau objek
mb Membuat bucket
mkdir Membuat objek dengan akhiran nama '/'
presign Menghasilkan URL yang ditandatangani sebelumnya untuk objek
probe Perintah deteksi
rb Menghapus bucket
restore Memulihkan objek status beku ke status siap dibaca
revert Mengembalikan objek yang dihapus ke status Pengendalian versi terbaru
rm Menghapus objek
set-props Mengatur properti objek
stat Menampilkan informasi meta bucket atau objek
sync Menyesuaikan direktori berkas lokal atau objek dari sumber ke tujuan
update Memperbarui ossutil
version Menampilkan versi
Topik bantuan tambahan:
filter Informasi lebih lanjut tentang bendera filter dan cara menggunakannya dalam perintah
Gunakan "ossutil [perintah] --help" untuk informasi lebih lanjut tentang suatu perintah.
Gunakan "ossutil [topik]" untuk informasi lebih lanjut tentang suatu topik.Subperintah
Bantuan untuk subperintah mencakup enam bagian:
| Bagian | Informasi yang diberikan |
|---|---|
| Deskripsi | Fungsi subperintah tersebut dan izin yang diperlukan |
| Penggunaan | Sintaks lengkap, termasuk argumen wajib dan [flags] untuk flag opsional |
| Alias | Nama alternatif untuk perintah tersebut, jika ada |
| Contoh | Perintah siap jalankan yang dapat Anda sesuaikan untuk kasus penggunaan Anda |
| Flag | Flag khusus untuk subperintah ini |
| Flag global | Flag yang berlaku untuk semua perintah |
Pada baris Penggunaan, argumen dalam tanda kurung siku ([flags]) bersifat opsional. Flag boolean seperti --dry-run tidak memerlukan nilai—sertakan flag tersebut untuk mengaktifkan perilaku atau hilangkan untuk menonaktifkannya.
Contoh 1: ossutil cat -h --language en
Concatenate an object to standard output.
To run this command, you must have the oss:GetObject permissions.
Usage: ossutil cat oss://bucket/object [flags]
Examples:
1) View the content of the example.txt object in the examplebucket bucket.
ossutil cat oss://examplebucket/example.txt
2) View the content of the example.txt object with version id CAEQARiBgID8rumR2h*** in the examplebucket.
ossutil cat oss://examplebucket/example.txt --version-id CAEQARiBgID8rumR2h***
3) Specify a range and view the content of the example.txt object in the examplebucket bucket.
Only print the first 10 characters
ossutil cat oss://examplebucket/example.txt --head 10
Only print the last 10 characters
ossutil cat oss://examplebucket/example.txt --tail 10
Only print all characters from offset 10
ossutil cat oss://examplebucket/example.txt --offset 10
Only print 20 characters from offset 10
ossutil cat oss://examplebucket/example.txt --offset 10 --count 20
Flags:
--count int Only print N characters (default -1)
--encoding-type string The encoding type of object name or file name that user inputs, valid value(s): "url"
--head int Only print the first N characters
--offset int Start printing at offset N
--request-payer string The payer of the request. set this value if you want pay for requester, valid value(s): "requester"
--tail int Only print the last N characters
--version-id string Specifies the object's version id
Global Flags:
-i, --access-key-id string AccessKeyID while access oss
-k, --access-key-secret string AccessKeySecret while access oss
--addressing-style string The style in which to address endpoints (default "virtual"), valid value(s): "virtual","path","cname"
-c, --config-file string path of the configuration file (default "~\\.ossutilconfig")
--connect-timeout int the client connection timed out, the unit is: s. (default 10)
-n, --dry-run do a trial run with no permanent changes
-e, --endpoint string the domain names that other services can use to access OSS.
-h, --help help for the command
--language string The display text language
--loglevel string the debug message level (default "off"), valid value(s): "off","info","debug"
--mode string Specifies the authentication mode, valid value(s): "AK","StsToken","EcsRamRole","Anonymous"
--output-format string the formatting style for command output (default "raw")
--output-properties strings the properties of output format
--output-query string a JMESPath query to use in filtering the response data
--profile string Specific profile from your config file.
--read-timeout int the client read timed out, the unit is: s. (default 20)
--region string the region in which the bucket is located.
--retry-times int retry times when fail (default 10)
--sign-version string The version of the signature algorithm (default "v4"), valid value(s): "v1","v4"
--skip-verify-cert specifies that the oss server's digital certificate file will not be verified
-t, --sts-token string STSToken while access ossContoh 2: ossutil api put-bucket-cors -h --language en
Configures cross-origin resource sharing (CORS) rules for a bucket.
* To call this operation, you must have the oss:PutBucketCors permission.
* Disabled-by-default design
By default, CORS is disabled for a bucket. All cross-origin requests are not allowed.
* Overwriting semantics
If you call the PutBucketCors operation to configure a new CORS rule for a bucket for which a CORS rule is already configured, the existing rule is overwritten.
* Use of CORS in applications
Before you can use CORS in applications, you must call the PutBucketCors operation to configure a CORS rule to enable CORS.
For example, you must call the PutBucketCors operation to configure a CORS rule to access Object Storage Service (OSS) applications from example.com by using the XMLHttpRequest feature of the browser. You must configure the CORS rule in the XML format.
* CORS rule matching
When OSS receives a cross-region request or an OPTIONS request, OSS reads the CORS rules configured for the corresponding bucket and performs permission checks. OSS checks the rules in turn. If OSS finds the first match, the corresponding header fields are returned in the response. If the request fails to match the CORS rules, the CORS-related header fields are not returned in the response.
OSS considers that a cross-origin request or an OPTIONS request matches a CORS rule only when the request meets the following conditions:
* The origin from which the cross-origin request is sent matches one of the values of AllowedOrigin in the CORS rule.
* The method of the cross-origin request such as GET or PUT or the method that corresponds to Access-Control-Request-Method in the OPTIONS request matches one of the values of AllowedMethod in the CORS rule.
* Each header that is included in Access-Control-Request-Headers in the OPTIONS request matches one of the values of AllowedHeader in the CORS rule.
More description of this api, see also: https://www.alibabacloud.com/help/en/oss/developer-reference/putbucketcors
Usage: ossutil api put-bucket-cors --bucket value --cors-configuration value [flags]
Examples:
--cors-configuration supports both XML and JSON syntax,
and when the option value contains a file:// prefix, it means that the configuration is read from the file.
XML Syntax:
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>string</AllowedOrigin>
...
<AllowedMethod>string</AllowedMethod>
...
<AllowedHeader>string</AllowedHeader>
<ExposeHeader>string</ExposeHeader>
...
<MaxAgeSeconds>integer</MaxAgeSeconds>
</CORSRule>
...
<ResponseVary>boolean</ResponseVary>
</CORSConfiguration>
JSON Syntax:
{
"CORSRule": [
{
"AllowedOrigin": ["string", ...],
"AllowedMethod": ["string", ...],
"AllowedHeader": "string",
"ExposeHeader": ["string", ...],
"MaxAgeSeconds": integer
},
...
],
"ResponseVary": boolean
}
1) Allows cross-origin PUT and GET requests from www.aliyun.com, and specifies that the browser caches the response to request for 10,000 seconds.
Uses xml config file, cors-configuration.xml as follows:
<CORSConfiguration>
<CORSRule>
<AllowedOrigin>www.aliyun.com</AllowedOrigin>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>10000</MaxAgeSeconds>
</CORSRule>
</CORSConfiguration>
ossutil api put-bucket-cors --bucket examplebucket --cors-configuration file://cors-configuration.xml
Uses json config file, cors-configuration.json as follows:
{
"CORSRule": {
"AllowedOrigin": ["www.aliyun.com"],
"AllowedMethod": ["PUT","GET"],
"MaxAgeSeconds": 10000
}
}
ossutil api put-bucket-cors --bucket examplebucket --cors-configuration file://cors-configuration.json
Uses json string in command line:
ossutil api put-bucket-cors --bucket examplebucket --cors-configuration "{\"CORSRule\":{\"AllowedOrigin\":[\"www.aliyun.com\"],\"AllowedMethod\":[\"PUT\",\"GET\"],\"MaxAgeSeconds\":10000}}"
Flags:
--bucket string The name of the bucket
--cors-configuration string The container that stores the information about CORS rules of the bucket
Global Flags:
-i, --access-key-id string AccessKeyID while access oss
-k, --access-key-secret string AccessKeySecret while access oss
--addressing-style string The style in which to address endpoints (default "virtual"), valid value(s): "virtual","path","cname"
-c, --config-file string path of the configuration file (default "~\\.ossutilconfig")
--connect-timeout int the client connection timed out, the unit is: s. (default 10)
-n, --dry-run do a trial run with no permanent changes
-e, --endpoint string the domain names that other services can use to access OSS.
-h, --help help for the command
--language string The display text language
--loglevel string the debug message level (default "off"), valid value(s): "off","info","debug"
--mode string Specifies the authentication mode, valid value(s): "AK","StsToken","EcsRamRole","Anonymous"
--output-format string the formatting style for command output (default "raw")
--output-properties strings the properties of output format
--output-query string a JMESPath query to use in filtering the response data
--profile string Specific profile from your config file.
--read-timeout int the client read timed out, the unit is: s. (default 20)
--region string the region in which the bucket is located.
--retry-times int retry times when fail (default 10)
--sign-version string The version of the signature algorithm (default "v4"), valid value(s): "v1","v4"
--skip-verify-cert specifies that the oss server's digital certificate file will not be verified
-t, --sts-token string STSToken while access ossTipe data flag
Setiap entri flag pada output bantuan mencantumkan tipe data setelah nama flag. Gunakan tabel berikut untuk memahami tipe tersebut dan memformat input Anda dengan benar.
| Tipe data | Format | Contoh |
|---|---|---|
string | Huruf, angka, simbol, dan spasi (ASCII). Bungkus nilai yang mengandung spasi dengan tanda kutip ganda. | --acl private |
| Boolean | Tidak memerlukan nilai — sertakan flag untuk mengaktifkan, hilangkan untuk menonaktifkan. | --dry-run |
int | Bilangan bulat tak bertanda. | --read-timeout 10 |
Time | Timestamp ISO 8601 (format DateTime atau Date). | --max-mtime 2006-01-02T15:04:05 |
SizeSuffix | Angka diikuti unit opsional. Unit default: B. Unit yang didukung: K (KiB), M (MiB), G (GiB), T (TiB), P (PiB), E (EiB). | --min-size 1024 atau --min-size 1K |
Duration | Angka diikuti unit waktu. Unit default: s (detik). Unit yang didukung: ms, s, m, h, d, w, M, y. Nilai desimal diterima. | --min-age 1.5d |
strings | Tentukan flag sekali atau beberapa kali. Setiap kemunculan menerima satu nilai atau nilai yang dipisahkan koma. | --metadata user=jack --metadata address=china |
stringArray | Tentukan flag sekali atau beberapa kali. Setiap kemunculan menerima tepat satu nilai. | --include *.jpg --include *.txt |