ListBucketInventory は、バケットのすべての在庫タスクをバッチで取得します。
注意事項
ListBucketInventory を呼び出してバケットからすべての在庫タスクをバッチで取得するには、oss:GetBucketInventory 権限が必要です。詳細については、「カスタムアクセス権限ポリシーを RAM ユーザーに付与する」をご参照ください。
1 回のリクエストで最大 100 個の在庫設定項目を取得します。100 個を超える項目を取得するには、複数のリクエストを送信してください。各リクエストからのトークンを保持し、次のリクエストのパラメーターとして使用します。
この操作を呼び出す際は、バケットの在庫タスクを管理するための十分な権限があることを確認してください。バケットオーナーはデフォルトでこの権限を持っています。この権限がない場合は、バケットオーナーにリクエストしてください。
リクエスト構文
continuation-token を使用する場合
GET /?inventory&continuation-token=xxx HTTP/1.1continuation-token を使用しない形式
GET /?inventory HTTP/1.1
応答要素
名前 | タイプ | 説明 |
InventoryConfiguration | Container | 在庫設定パラメーターのコンテナー。 |
IsTruncated | Boolean | すべての在庫タスクがリスト表示されているかどうかを示します。 有効な値: true または false
|
NextContinuationToken | String | 応答の IsTruncated が true で、NextContinuationToken が空でない場合、このフィールドを次のリストリクエストの continuation-token パラメーターとして使用します。 |
Id | String | ユーザー指定の在庫名。この名前は、現在のバケット内でグローバルに一意である必要があります。 |
IsEnabled | Boolean | 在庫が有効になっているかどうかを示します。 有効な値: true または false
|
Filter | Container | 在庫フィルタリングのプレフィックス。プレフィックスを指定すると、在庫はプレフィックス設定に一致するオブジェクトをフィルタリングします。 |
Prefix | String | フィルタリングルールの一致するプレフィックス。 親ノード: Filter |
Destination | Container | 在庫結果に関する情報のコンテナー。 |
OSSBucketDestination | Container | エクスポートされた在庫結果が保存されるバケットに関する情報。 親ノード: Destination |
Format | String | エクスポートされた在庫ファイルのファイル形式。 有効な値: CSV 親ノード: OSSBucketDestination |
AccountId | String | バケットオーナーによって付与される AccountId。 親ノード: OSSBucketDestination |
RoleArn | String | バケットオーナーが操作権限を付与するロール名。 形式: acs:ram::uid:role/rolename 親ノード: OSSBucketDestination |
Bucket | String | エクスポートされた在庫ファイルを保存するバケット。 親ノード: OSSBucketDestination |
Prefix | String | 在庫ファイルのストレージパスプレフィックス。 親ノード: OSSBucketDestination |
Encryption | Container | 在庫ファイルの暗号化方式。 有効な値: SSE-OSS、SSE-KMS、または Null 親ノード: OSSBucketDestination |
SSE-OSS | Container | SSE-OSS 暗号化方式のコンテナー。 親ノード: Encryption |
SSE-KMS | Container | SSE-KMS 暗号化方式で使用されるキーのコンテナー。 親ノード: Encryption |
KeyId | String | KMS キー ID。 親ノード: SSE-KMS |
Schedule | Container | 在庫エクスポートサイクル情報のコンテナー。 |
Frequency | String | 在庫ファイルのエクスポートサイクル。 有効な値: Daily または Weekly 親ノード: Schedule |
IncludedObjectVersions | String | 在庫にオブジェクトバージョン情報を含めるかどうかを示します。 有効な値: All または Current
|
OptionalFields | Container | 在庫結果に含める設定項目のコンテナー。 |
Field | Container | 在庫結果に含まれる設定項目。 オプションの設定項目: Size、LastModifiedDate、TransitionTime、ETag、StorageClass、IsMultipartUploaded、EncryptionStatus、ObjectAcl、TaggingCount、ObjectType、Crc64 親ノード: OptionalFields |
IncrementalInventory | Container | 増分在庫の設定情報。 |
IsEnabled | Boolean | 増分在庫が有効になっているかどうかを示します。 有効な値:
true の場合、増分在庫機能が有効になり、上位レベルの enable=false 設定の影響を受けません。 親ノード: IncrementalInventory |
Schedule | Container | 増分在庫のエクスポートサイクル。 親ノード: IncrementalInventory |
Frequency | Positive integer | 増分在庫のエクスポート頻度 (秒単位)。 システムは現在、600 秒の固定サイクルを使用しています。各サイクルでディレクトリプレフィックスが自動的に作成され、対応するマニフェストファイルと、そのサイクル内で生成された複数の CSV ファイルが生成されます。カスタム頻度設定はサポートされていません。 親ノード: Schedule |
OptionalFields | Container | 増分在庫に含める設定項目を設定します。 親ノード: IncrementalInventory |
Field | String | 増分在庫に含まれる設定項目。 親ノード: OptionalFields
|
例
リクエスト例
GET /?inventory HTTP/1.1 Host: BucketName.oss.aliyuncs.com Date: Fri, 24 Feb 2012 03:55:00 GMT Authorization: authorization string Content-Type: text/plain応答例
HTTP/1.1 200 OK x-oss-request-id: 56594298207FB304438516F9 Date: Sat, 30 Apr 2016 23:29:37 GMT Content-Type: application/xml Content-Length: length Connection: close Server: AliyunOSS <?xml version="1.0" encoding="UTF-8"?> <ListInventoryConfigurationsResult> <InventoryConfiguration> <Id>report1</Id> <IsEnabled>true</IsEnabled> <Destination> <OSSBucketDestination> <Format>CSV</Format> <AccountId>1000000000000000</AccountId> <RoleArn>acs:ram::1000000000000000:role/AliyunOSSRole</RoleArn> <Bucket>acs:oss:::destination-bucket</Bucket> <Prefix>prefix1</Prefix> </OSSBucketDestination> </Destination> <Schedule> <Frequency>Daily</Frequency> </Schedule> <Filter> <Prefix>prefix/One</Prefix> </Filter> <IncludedObjectVersions>All</IncludedObjectVersions> <OptionalFields> <Field>Size</Field> <Field>LastModifiedDate</Field> <Field>ETag</Field> <Field>StorageClass</Field> <Field>IsMultipartUploaded</Field> <Field>EncryptionStatus</Field> </OptionalFields> </InventoryConfiguration> <InventoryConfiguration> <Id>report2</Id> <IsEnabled>true</IsEnabled> <Destination> <OSSBucketDestination> <Format>CSV</Format> <AccountId>1000000000000000</AccountId> <RoleArn>acs:ram::1000000000000000:role/AliyunOSSRole</RoleArn> <Bucket>acs:oss:::destination-bucket</Bucket> <Prefix>prefix2</Prefix> </OSSBucketDestination> </Destination> <Schedule> <Frequency>Daily</Frequency> </Schedule> <Filter> <Prefix>prefix/Two</Prefix> </Filter> <IncludedObjectVersions>All</IncludedObjectVersions> <OptionalFields> <Field>Size</Field> <Field>LastModifiedDate</Field> <Field>ETag</Field> <Field>StorageClass</Field> <Field>IsMultipartUploaded</Field> <Field>EncryptionStatus</Field> </OptionalFields> </InventoryConfiguration> <InventoryConfiguration> <Id>report3</Id> <IsEnabled>true</IsEnabled> <Destination> <OSSBucketDestination> <Format>CSV</Format> <AccountId>1000000000000000</AccountId> <RoleArn>acs:ram::1000000000000000:role/AliyunOSSRole</RoleArn> <Bucket>acs:oss:::destination-bucket</Bucket> <Prefix>prefix3</Prefix> </OSSBucketDestination> </Destination> <Schedule> <Frequency>Daily</Frequency> </Schedule> <Filter> <Prefix>prefix/Three</Prefix> </Filter> <IncludedObjectVersions>All</IncludedObjectVersions> <OptionalFields> <Field>Size</Field> <Field>LastModifiedDate</Field> <Field>ETag</Field> <Field>StorageClass</Field> <Field>IsMultipartUploaded</Field> <Field>EncryptionStatus</Field> </OptionalFields> </InventoryConfiguration> ... <IsTruncated>true</IsTruncated> <NextContinuationToken>...</NextContinuationToken> </ListInventoryConfigurationsResult>
SDK
このインターフェイスの SDK は次のとおりです。
コマンドラインツール ossutil
ListBucketInventory API に対応する ossutil コマンドの詳細については、「list-bucket-inventory」をご参照ください。