APIドキュメント
バケット・メタデータのリスト
以下のサンプルコードでは、my-bucket という名前のバケツのメタデータを取得する方法を説明します。以下はIDrive®e2のChicago リージョンの例です。
以下の操作を行う前に、必要な設定手順に従ってください。
バケツのメタデータを表示するには、以下のコマンドを使います。
aws s3api head-bucket --bucket my-bucket --endpoint-url https://storageendpoint
バケツのメタデータを表示するには、以下のコードを使います。
/bin/python インポートboto3 # IDrive e2用のS3クライアントを作成する。 endpoint = "l4g4.ch11.idrivee2-2.com" クライアント = boto3.client("s3", endpoint_url=endpoint) # バケツ'my-bucket'をヘッドする。 print(client.head_bucket(Bucket="my-bucket"))
const AWS = require('aws-sdk'); // Create an S3 client for IDrive e2 const s3 = new AWS.S3({ endpoint: "https://xyz1.ch11.idrivee2-2.com", //your storage-endpoint accessKeyId: process.env.access_key, //your access-key secretAccessKey: process.env.secret_key, //your secret-key }); // bucket params var params = { Bucket: "my-bucket", }; // head bucket with the above params s3.headBucket(params, function(err, data) { if (err) { console.log("Error:", err); } else { console.log("Success:", data); } });
バケツのメタデータを表示するには、以下のコマンドを使います。以下は、Composer を使ったインストール方法の例です。その他の方法については、 PHP の使用法に従って以下のコードの"require"ステートメントを変更してください。
<?php require "vendor/autoload.php"; use Aws\S3\S3Client; use Aws\Exception\AwsException; // Create an S3 client for IDrive e2 $profile_credentials = [ "profile" => "default", "endpoint" => "l4g4.ch11.idrivee2-2.com", "region" => "Chicago", "version" => "latest", "use_path_style_endpoint" => true, ]; $s3 = S3Client::factory($profile_credentials); // head bucket 'my-bucket' try { $result = $s3->headBucket([ "Bucket" => "my-bucket", ]); echo "Success: "; var_dump($result["@metadata"]); } catch (AwsException $e) { echo "Error: {$e->getMessage()}" . PHP_EOL; }
require 'aws-sdk-s3' # Create an S3 client for IDrive e2 endpoint = 'l4g4.ch11.idrivee2-2.com' client = Aws::S3::Client.new(region: 'Chicago', endpoint: endpoint) # head bucket 'my-bucket' begin puts "Success: #{client.head_bucket(bucket: 'my-bucket')}" rescue StandardError => ex puts "Error: #{ex}" end