すべてのプロダクト
Search
ドキュメントセンター

Object Storage Service:help

最終更新日:Aug 28, 2024

このトピックでは、ossutilコマンドに関するヘルプ情報を取得する方法について説明します。

組み込みのヘルプコマンド

-hまたは -- helpオプションを指定してコマンドを終了し、コマンドに関するヘルプ情報を取得できます。 ossutil [topic] を使用して、指定したトピックのヘルプドキュメントを取得できます。 次の表に、ヘルパーコマンドのサンプルを示します。

説明

コマンド

ossutilで使用可能な高レベルコマンドのヘルプを表示します。

ossutil -h

cpコマンドのヘルプを表示します。

ossutil cp -h

APIコマンドセット内のすべてのサブコマンドを表示します。

ossutil api -h

APIコマンド名前空間のput-bucket-corsサブコマンドのヘルプを表示します。

ossutil api put-bucket-cors -h

フィルターオプションのヘルプを表示します。

ossutil filter

コマンドヘルプ情報

コマンドは、親コマンドとサブコマンドの2つのカテゴリに分類されます。 親コマンドはサブコマンドを含み、サブコマンドは他のコマンドを含まない。

親コマンド

親コマンドに関するヘルプ情報には、説明、使用法、サブコマンドのリスト、追加のヘルプトピック、およびその他のヘルプ情報の5つの側面が含まれます。

ossutil is a tool for managing OSS (Object Storage Service) data.

Usage: ossutil [command]

Available Commands:
  api         The API-level commands
  append      Append content to a appendable object
  cat         Concatenate an object to standard output
  config      Creates a config file and stores configuration settings and credentials
  cp          Upload, Download or Copy Objects
  du          Get the bucket or the specified prefix(directory) storage size
  hash        Get the hash value of file
  help        Help about any command
  ls          List buckets or objects
  mb          Creates a bucket
  mkdir       Create an object with name suffix '/'
  presign     Generate a pre-signed URL for object
  probe       Detection command
  rb          Delete bucket
  restore     Restore frozen state object to read ready status
  revert      Revert the deleted object to the latest versioning state
  rm          Deletes objects
  set-props   Set the property of objects
  stat        Display meta information of bucket or objects
  sync        Sync the local file directory or objects from the source to the destination
  update      Update ossutil
  version     Show version

Additional help topics:
  filter      more information about filter flags, and how to use it in commands

Use "ossutil [command] --help" for more information about a command.
Use "ossutil [topic]" for more information about a topic.

サブコマンド

サブコマンドに関するヘルプ情報には、説明、使用法、オプションのエイリアス、例、ローカルフラグ (オプション) 、グローバルフラグ (オプション) の6つの側面があります。

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 oss

例2: put-bucket-cosr

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 oss

サブコマンドの各オプションに関する情報には、データ型、オプション名、および説明が含まれます。

データ型

オプション名

説明

String

-オプション文字列

  • 文字列引数には、文字、数字、記号、およびスペースをASCII文字セットに含めることができます。

  • スペースが含まれている場合は、スペースを二重引用符 (") で囲みます。

例: -- acl private

Boolean

-オプション

オプションをオンまたはオフにします。

例: -- dry-run

Integer

-オプションInt

符号なし整数。

例: -- read-timeout 10

Timestamp

-オプション時間

ISO 8601形式のタイムスタンプ (DateTimeまたはDate)

例: -- max-mtime 2006-01-02T15:04:05

サイズ接尾辞

-オプションSizeSuffix

サイズ単位。 デフォルトの単位はBです。他の支持単位は、K (KiB) 、M (MiB) 、G (GiB) 、T (TiB) 、P (PiB) 、およびE (EiB) を含む。

例:

-- 最小サイズの1024

-- 最小サイズ1K

時間の単位

-オプション期間

時間単位。 デフォルトの単位は秒です。

サポートされる時間単位は、ミリ秒 (ms) 、秒 (s) 、分 (m) 、時間 (h) 、日 (d) 、週 (w) 、月 (M) 、および年 (y) です。

数値は、小数とすることができる。

例: 1.5d

-- 分年齢1.5d

String list

-オプション文字列

コマンドでオプションを1回または複数回指定できます。 オプションの出現ごとに、単一の引数または複数のコンマ区切りの引数を指定できます。

例: -- metadata user=jack, -- metadata address=china

文字列配列

-- option stringArray

コマンドでオプションを1回または複数回指定できます。 オプションの出現ごとに指定できる引数は1つだけです。

例: -- include *.jpg -- include *.txt