提交
This commit is contained in:
45
vendor/alibabacloud/oss-v2/sample/AbortBucketWorm.php
vendored
Normal file
45
vendor/alibabacloud/oss-v2/sample/AbortBucketWorm.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\AbortBucketWormRequest($bucket);
|
||||
$result = $client->abortBucketWorm($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
50
vendor/alibabacloud/oss-v2/sample/AbortMultipartUpload.php
vendored
Normal file
50
vendor/alibabacloud/oss-v2/sample/AbortMultipartUpload.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
"upload-id" => ['help' => 'The upload id', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
$uploadId = $options["upload-id"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\AbortMultipartUploadRequest($bucket, $key);
|
||||
$request->uploadId = $uploadId;
|
||||
$result = $client->abortMultipartUpload($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
54
vendor/alibabacloud/oss-v2/sample/AppendObject.php
vendored
Normal file
54
vendor/alibabacloud/oss-v2/sample/AppendObject.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$data = 'Hello Append Object';
|
||||
|
||||
$request = new Oss\Models\AppendObjectRequest($bucket, $key);
|
||||
$request->body = Oss\Utils::streamFor($data);
|
||||
$request->position = 0;
|
||||
|
||||
$result = $client->appendObject($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
59
vendor/alibabacloud/oss-v2/sample/AsyncProcessObject.php
vendored
Normal file
59
vendor/alibabacloud/oss-v2/sample/AsyncProcessObject.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$style = "video/convert,f_avi,vcodec_h265,s_1920x1080,vb_2000000,fps_30,acodec_aac,ab_100000,sn_1";
|
||||
$process = sprintf("%s|sys/saveas,b_%s,o_%s",
|
||||
$style,
|
||||
rtrim(base64_encode($bucket), '='),
|
||||
rtrim(base64_encode($key), '=')
|
||||
);
|
||||
|
||||
$request = new Oss\Models\AsyncProcessObjectRequest($bucket, $key);
|
||||
$request->process = $process;
|
||||
|
||||
$result = $client->asyncProcessObject($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'async process result:' . var_export($result, true)
|
||||
);
|
||||
49
vendor/alibabacloud/oss-v2/sample/CleanRestoredObject.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/CleanRestoredObject.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\CleanRestoredObjectRequest($bucket, $key);
|
||||
$result = $client->cleanRestoredObject($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
45
vendor/alibabacloud/oss-v2/sample/CloseMetaQuery.php
vendored
Normal file
45
vendor/alibabacloud/oss-v2/sample/CloseMetaQuery.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new \AlibabaCloud\Oss\V2\Models\CloseMetaQueryRequest($bucket);
|
||||
$result = $client->closeMetaQuery($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
125
vendor/alibabacloud/oss-v2/sample/CompleteMultipartUpload.php
vendored
Normal file
125
vendor/alibabacloud/oss-v2/sample/CompleteMultipartUpload.php
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
"upload-id" => ['help' => 'The upload id', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
$uploadId = $options["upload-id"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\UploadPartRequest($bucket, $key);
|
||||
$bigFileName = "upload.tmp";
|
||||
$partSize = 200 * 1024;
|
||||
generateFile($bigFileName, 500 * 1024);
|
||||
$file = fopen($bigFileName, 'r');
|
||||
$parts = array();
|
||||
if ($file) {
|
||||
$i = 1;
|
||||
while (!feof($file)) {
|
||||
$chunk = fread($file, $partSize);
|
||||
$partResult = $client->uploadPart(
|
||||
new Oss\Models\UploadPartRequest(
|
||||
$bucket,
|
||||
$key,
|
||||
$i,
|
||||
$uploadId,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
Oss\Utils::streamFor($chunk)
|
||||
)
|
||||
);
|
||||
$part = new Oss\Models\UploadPart(
|
||||
$i,
|
||||
$partResult->etag,
|
||||
);
|
||||
array_push($parts, $part);
|
||||
$i++;
|
||||
}
|
||||
fclose($file);
|
||||
}
|
||||
$comResult = $client->completeMultipartUpload(
|
||||
new Oss\Models\CompleteMultipartUploadRequest(
|
||||
$bucket,
|
||||
$key,
|
||||
$uploadId,
|
||||
null,
|
||||
new Oss\Models\CompleteMultipartUpload(
|
||||
$parts
|
||||
),
|
||||
)
|
||||
);
|
||||
unlink($bigFileName);
|
||||
printf(
|
||||
'status code:' . $comResult->statusCode . PHP_EOL .
|
||||
'request id:' . $comResult->requestId . PHP_EOL .
|
||||
'complete multipart upload result:' . var_export($comResult, true)
|
||||
);
|
||||
|
||||
function generateFile($filename, $size)
|
||||
{
|
||||
if (
|
||||
file_exists($filename) &&
|
||||
$size == sprintf('%u', filesize($filename))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
$part_size = 32;
|
||||
$fp = fopen($filename, "w");
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
|
||||
$charactersLength = strlen($characters);
|
||||
if ($fp) {
|
||||
while ($size > 0) {
|
||||
if ($size < $part_size) {
|
||||
$write_size = $size;
|
||||
} else {
|
||||
$write_size = $part_size;
|
||||
}
|
||||
$size -= $write_size;
|
||||
$a = $characters[rand(0, $charactersLength - 1)];
|
||||
$content = str_repeat($a, $write_size);
|
||||
$flag = fwrite($fp, $content);
|
||||
if (!$flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
120
vendor/alibabacloud/oss-v2/sample/Copier.php
vendored
Normal file
120
vendor/alibabacloud/oss-v2/sample/Copier.php
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
"src-key" => ['help' => 'The name of the source object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
$srcKey = $options["src-key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$copier = $client->newCopier();
|
||||
|
||||
// case 1, empty metadata & tagging
|
||||
$dstKey = "multipart-copy-repalce-empty-metadata-and-tagging-$key.js";
|
||||
$copyRequest = new Oss\Models\CopyObjectRequest(
|
||||
$bucket,
|
||||
$dstKey,
|
||||
$bucket,
|
||||
$srcKey
|
||||
);
|
||||
$copyRequest->metadataDirective = 'REPLACE';
|
||||
$copyRequest->taggingDirective = 'REPLACE';
|
||||
$result = $copier->copy(
|
||||
$copyRequest,
|
||||
[
|
||||
'multipart_copy_threshold' => 0,
|
||||
'disable_shallow_copy' => true
|
||||
]
|
||||
);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL
|
||||
);
|
||||
|
||||
// case 2, has metadata & tagging
|
||||
$dstKey = "multipart-copy-repalce-metadata-and-tagging-$key.js";
|
||||
$copyRequest = new Oss\Models\CopyObjectRequest(
|
||||
$bucket,
|
||||
$dstKey,
|
||||
$bucket,
|
||||
$srcKey
|
||||
);
|
||||
$copyRequest->metadataDirective = 'REPLACE';
|
||||
$copyRequest->taggingDirective = 'REPLACE';
|
||||
$copyRequest->contentType = 'text/txt';
|
||||
$copyRequest->cacheControl = 'cache-123';
|
||||
$copyRequest->contentDisposition = 'contentDisposition';
|
||||
$copyRequest->expires = '123';
|
||||
$copyRequest->metadata = ['test1' => 'val1', 'test2' => 'value2'];
|
||||
$copyRequest->tagging = 'k3=v3&k4=v4';
|
||||
$result = $copier->copy(
|
||||
$copyRequest,
|
||||
[
|
||||
'multipart_copy_threshold' => 0,
|
||||
'disable_shallow_copy' => true
|
||||
]
|
||||
);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL
|
||||
);
|
||||
|
||||
// multipart copy, 'copy' directive
|
||||
$copyRequest = new Oss\Models\CopyObjectRequest(
|
||||
$bucket,
|
||||
$dstKey,
|
||||
$bucket,
|
||||
$srcKey
|
||||
);
|
||||
$copyRequest->contentType = 'text/txt';
|
||||
$copyRequest->cacheControl = 'cache-123';
|
||||
$copyRequest->contentDisposition = 'contentDisposition';
|
||||
$copyRequest->expires = '123';
|
||||
$copyRequest->metadata = ['test1' => 'val1', 'test2' => 'value2'];
|
||||
$copyRequest->tagging = 'k3=v3&k4=v4';
|
||||
$result = $copier->copy(
|
||||
$copyRequest,
|
||||
[
|
||||
'multipart_copy_threshold' => 0,
|
||||
'disable_shallow_copy' => true
|
||||
]
|
||||
);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
57
vendor/alibabacloud/oss-v2/sample/CopyObject.php
vendored
Normal file
57
vendor/alibabacloud/oss-v2/sample/CopyObject.php
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
"src-bucket" => ['help' => 'The name of the source bucket', 'required' => False],
|
||||
"src-key" => ['help' => 'The name of the source object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
$srcKey = $options["src-key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\CopyObjectRequest($bucket, $key);
|
||||
if (!empty($options["src-bucket"])) {
|
||||
$request->sourceBucket = $options["src-bucket"];
|
||||
}
|
||||
$request->sourceKey = $srcKey;
|
||||
|
||||
$result = $client->copyObject($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
52
vendor/alibabacloud/oss-v2/sample/CreateAccessPoint.php
vendored
Normal file
52
vendor/alibabacloud/oss-v2/sample/CreateAccessPoint.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$accessPointName = 'ap-01';
|
||||
$config = new Oss\Models\CreateAccessPointConfiguration();
|
||||
$config->accessPointName = $accessPointName;
|
||||
$config->networkOrigin = 'internet';
|
||||
$request = new Oss\Models\CreateAccessPointRequest($bucket, $config);
|
||||
$result = $client->createAccessPoint($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'create access point:' . var_export($result->createAccessPoint, true)
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/CreateBucketDataRedundancyTransition.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/CreateBucketDataRedundancyTransition.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\CreateBucketDataRedundancyTransitionRequest($bucket, 'ZRS');
|
||||
$result = $client->createBucketDataRedundancyTransition($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'task id:' . $result->bucketDataRedundancyTransition->taskId
|
||||
);
|
||||
51
vendor/alibabacloud/oss-v2/sample/CreateCnameToken.php
vendored
Normal file
51
vendor/alibabacloud/oss-v2/sample/CreateCnameToken.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\CreateCnameTokenRequest($bucket, new Oss\Models\BucketCnameConfiguration(
|
||||
new Oss\Models\Cname(
|
||||
'example.com'
|
||||
)
|
||||
));
|
||||
$result = $client->createCnameToken($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'cname token:' . var_export($result->cnameToken, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/DeleteAccessPoint.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/DeleteAccessPoint.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$accessPointName = 'ap-01';
|
||||
$request = new Oss\Models\DeleteAccessPointRequest($bucket, $accessPointName);
|
||||
$result = $client->deleteAccessPoint($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucket.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucket.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\DeleteBucketRequest($bucket);
|
||||
$result = $client->deleteBucket($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketCors.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketCors.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketCorsRequest($bucket);
|
||||
$result = $client->deleteBucketCors($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketDataRedundancyTransition.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketDataRedundancyTransition.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"task-id" => ['help' => 'The Id of the redundancy change task.', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$taskId = $options["task-id"];
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketDataRedundancyTransitionRequest($bucket, $taskId);
|
||||
$result = $client->deleteBucketDataRedundancyTransition($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketEncryption.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketEncryption.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketEncryptionRequest($bucket);
|
||||
$result = $client->deleteBucketEncryption($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
50
vendor/alibabacloud/oss-v2/sample/DeleteBucketInventory.php
vendored
Normal file
50
vendor/alibabacloud/oss-v2/sample/DeleteBucketInventory.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$inventoryId = 'test-inventory-id';
|
||||
$request = new Oss\Models\DeleteBucketInventoryRequest(
|
||||
$bucket,
|
||||
inventoryId: $inventoryId
|
||||
);
|
||||
$result = $client->deleteBucketInventory($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketLifecycle.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketLifecycle.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketLifecycleRequest($bucket);
|
||||
$result = $client->deleteBucketLifecycle($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketLogging.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketLogging.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketLoggingRequest($bucket);
|
||||
$result = $client->deleteBucketLogging($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketOverwrite.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketOverwrite.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketOverwriteConfigRequest($bucket);
|
||||
$result = $client->deleteBucketOverwriteConfig($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketPolicy.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketPolicy.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketPolicyRequest($bucket);
|
||||
$result = $client->deleteBucketPolicy($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL
|
||||
);
|
||||
|
||||
46
vendor/alibabacloud/oss-v2/sample/DeleteBucketPublicAccessBlock.php
vendored
Normal file
46
vendor/alibabacloud/oss-v2/sample/DeleteBucketPublicAccessBlock.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketPublicAccessBlockRequest($bucket);
|
||||
$result = $client->deleteBucketPublicAccessBlock($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
51
vendor/alibabacloud/oss-v2/sample/DeleteBucketReplication.php
vendored
Normal file
51
vendor/alibabacloud/oss-v2/sample/DeleteBucketReplication.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
use AlibabaCloud\Oss\V2\Models\LifecycleConfiguration;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"rule-id" => ['help' => 'The replication rule id of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$ruleId = $options["rule-id"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketReplicationRequest($bucket, replicationRules: new Oss\Models\ReplicationRules(
|
||||
ids: [$ruleId]
|
||||
));
|
||||
$result = $client->deleteBucketReplication($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketTags.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketTags.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketTagsRequest($bucket);
|
||||
$result = $client->deleteBucketTags($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketWebsite.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/DeleteBucketWebsite.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteBucketWebsiteRequest($bucket);
|
||||
$result = $client->deleteBucketWebsite($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
50
vendor/alibabacloud/oss-v2/sample/DeleteCname.php
vendored
Normal file
50
vendor/alibabacloud/oss-v2/sample/DeleteCname.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteCnameRequest($bucket, new Oss\Models\BucketCnameConfiguration(
|
||||
new Oss\Models\Cname(
|
||||
'example.com'
|
||||
)
|
||||
));
|
||||
$result = $client->deleteCname($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
57
vendor/alibabacloud/oss-v2/sample/DeleteMultipleObjects.php
vendored
Normal file
57
vendor/alibabacloud/oss-v2/sample/DeleteMultipleObjects.php
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"keys" => ['help' => 'The name of the objects', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$keys = $options["keys"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\DeleteMultipleObjectsRequest($bucket);
|
||||
$objects = explode(',', $keys);
|
||||
$deleteObjects = [];
|
||||
foreach ($objects as $key => $object) {
|
||||
$deleteObjects[] = new Oss\Models\DeleteObject($object);
|
||||
}
|
||||
$request->objects = $deleteObjects;
|
||||
|
||||
$result = $client->deleteMultipleObjects($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'deleted objects' . var_export($result->deletedObjects, true)
|
||||
);
|
||||
50
vendor/alibabacloud/oss-v2/sample/DeleteObject.php
vendored
Normal file
50
vendor/alibabacloud/oss-v2/sample/DeleteObject.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\DeleteObjectRequest($bucket, $key);
|
||||
|
||||
$result = $client->deleteObject($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
46
vendor/alibabacloud/oss-v2/sample/DeleteObjectTagging.php
vendored
Normal file
46
vendor/alibabacloud/oss-v2/sample/DeleteObjectTagging.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteObjectTaggingRequest($bucket, $key);
|
||||
$result = $client->deleteObjectTagging($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
44
vendor/alibabacloud/oss-v2/sample/DeletePublicAccessBlock.php
vendored
Normal file
44
vendor/alibabacloud/oss-v2/sample/DeletePublicAccessBlock.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeletePublicAccessBlockRequest();
|
||||
$result = $client->deletePublicAccessBlock($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
49
vendor/alibabacloud/oss-v2/sample/DeleteStyle.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/DeleteStyle.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteStyleRequest(
|
||||
$bucket,
|
||||
styleName: 'test',
|
||||
);
|
||||
$result = $client->deleteStyle($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
46
vendor/alibabacloud/oss-v2/sample/DeleteUserDefinedLogFieldsConfig.php
vendored
Normal file
46
vendor/alibabacloud/oss-v2/sample/DeleteUserDefinedLogFieldsConfig.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\DeleteUserDefinedLogFieldsConfigRequest($bucket);
|
||||
$result = $client->deleteUserDefinedLogFieldsConfig($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/DeletetAccessPointPolicy.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/DeletetAccessPointPolicy.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$accessPointName = 'ap-01';
|
||||
$request = new Oss\Models\DeleteAccessPointPolicyRequest($bucket, $accessPointName);
|
||||
$result = $client->deleteAccessPointPolicy($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
46
vendor/alibabacloud/oss-v2/sample/DescribeRegions.php
vendored
Normal file
46
vendor/alibabacloud/oss-v2/sample/DescribeRegions.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\DescribeRegionsRequest();
|
||||
|
||||
$result = $client->describeRegions($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'result:' . var_export($result, true)
|
||||
);
|
||||
80
vendor/alibabacloud/oss-v2/sample/DoMetaQuery.php
vendored
Normal file
80
vendor/alibabacloud/oss-v2/sample/DoMetaQuery.php
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
// case 1:meta search
|
||||
$request = new \AlibabaCloud\Oss\V2\Models\DoMetaQueryRequest($bucket, new \AlibabaCloud\Oss\V2\Models\MetaQuery(
|
||||
maxResults: 5,
|
||||
query: "{'Field': 'Size','Value': '1048576','Operation': 'gt'}",
|
||||
sort: 'Size',
|
||||
order: \AlibabaCloud\Oss\V2\Models\MetaQueryOrderType::ASC,
|
||||
aggregations: new \AlibabaCloud\Oss\V2\Models\MetaQueryAggregations(
|
||||
[
|
||||
new \AlibabaCloud\Oss\V2\Models\MetaQueryAggregation(
|
||||
field: 'Size',
|
||||
operation: 'sum'
|
||||
),
|
||||
new \AlibabaCloud\Oss\V2\Models\MetaQueryAggregation(
|
||||
field: 'Size',
|
||||
operation: 'max'
|
||||
),
|
||||
]
|
||||
),
|
||||
));
|
||||
$result = $client->doMetaQuery($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'result:' . var_export($result, true)
|
||||
);
|
||||
|
||||
// case 2: ai search
|
||||
/*$request = new Oss\Models\DoMetaQueryRequest($bucket, new Oss\Models\MetaQuery(
|
||||
maxResults: 99,
|
||||
query: "Overlook the snow-covered forest",
|
||||
mediaTypes: new Oss\Models\MetaQueryMediaTypes('image'),
|
||||
simpleQuery: '{"Operation":"gt", "Field": "Size", "Value": "30"}',
|
||||
), 'semantic');
|
||||
|
||||
$result = $client->doMetaQuery($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'result:' . var_export($result, true)
|
||||
);*/
|
||||
71
vendor/alibabacloud/oss-v2/sample/Downloader.php
vendored
Normal file
71
vendor/alibabacloud/oss-v2/sample/Downloader.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$downloader = $client->newDownloader();
|
||||
|
||||
// download to
|
||||
$stream = new \GuzzleHttp\Psr7\BufferStream(1 * 1024 * 1024);
|
||||
$result = $downloader->downloadTo(
|
||||
new Oss\Models\GetObjectRequest(
|
||||
$bucket,
|
||||
$key
|
||||
),
|
||||
$stream,
|
||||
);
|
||||
printf(
|
||||
'download to body:' . $stream->getContents() . PHP_EOL
|
||||
);
|
||||
|
||||
// download file
|
||||
$filename = "download.tmp";
|
||||
touch($filename);
|
||||
$result = $downloader->downloadFile(
|
||||
new Oss\Models\GetObjectRequest(
|
||||
$bucket,
|
||||
$key
|
||||
),
|
||||
$filename,
|
||||
);
|
||||
printf(
|
||||
'download file body:' . file_get_contents($filename)
|
||||
);
|
||||
unlink($filename);
|
||||
172
vendor/alibabacloud/oss-v2/sample/EncryptionClient.php
vendored
Normal file
172
vendor/alibabacloud/oss-v2/sample/EncryptionClient.php
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
const RSA_PUBLIC_KEY = <<<BBB
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCokfiAVXXf5ImFzKDw+XO/UByW
|
||||
6mse2QsIgz3ZwBtMNu59fR5zttSx+8fB7vR4CN3bTztrP9A6bjoN0FFnhlQ3vNJC
|
||||
5MFO1PByrE/MNd5AAfSVba93I6sx8NSk5MzUCA4NJzAUqYOEWGtGBcom6kEF6MmR
|
||||
1EKib1Id8hpooY5xaQIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
BBB;
|
||||
|
||||
const RSA_PRIVATE_KEY = <<<BBB
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAKiR+IBVdd/kiYXM
|
||||
oPD5c79QHJbqax7ZCwiDPdnAG0w27n19HnO21LH7x8Hu9HgI3dtPO2s/0DpuOg3Q
|
||||
UWeGVDe80kLkwU7U8HKsT8w13kAB9JVtr3cjqzHw1KTkzNQIDg0nMBSpg4RYa0YF
|
||||
yibqQQXoyZHUQqJvUh3yGmihjnFpAgMBAAECgYA49RmCQ14QyKevDfVTdvYlLmx6
|
||||
kbqgMbYIqk+7w611kxoCTMR9VMmJWgmk/Zic9mIAOEVbd7RkCdqT0E+xKzJJFpI2
|
||||
ZHjrlwb21uqlcUqH1Gn+wI+jgmrafrnKih0kGucavr/GFi81rXixDrGON9KBE0FJ
|
||||
cPVdc0XiQAvCBnIIAQJBANXu3htPH0VsSznfqcDE+w8zpoAJdo6S/p30tcjsDQnx
|
||||
l/jYV4FXpErSrtAbmI013VYkdJcghNSLNUXppfk2e8UCQQDJt5c07BS9i2SDEXiz
|
||||
byzqCfXVzkdnDj9ry9mba1dcr9B9NCslVelXDGZKvQUBqNYCVxg398aRfWlYDTjU
|
||||
IoVVAkAbTyjPN6R4SkC4HJMg5oReBmvkwFCAFsemBk0GXwuzD0IlJAjXnAZ+/rIO
|
||||
ItewfwXIL1Mqz53lO/gK+q6TR585AkB304KUIoWzjyF3JqLP3IQOxzns92u9EV6l
|
||||
V2P+CkbMPXiZV6sls6I4XppJXX2i3bu7iidN3/dqJ9izQK94fMU9AkBZvgsIPCot
|
||||
y1/POIbv9LtnviDKrmpkXgVQSU4BmTPvXwTJm8APC7P/horSh3SVf1zgmnsyjm9D
|
||||
hO92gGc+4ajL
|
||||
-----END PRIVATE KEY-----
|
||||
BBB;
|
||||
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$masterCipher = new Oss\Crypto\MasterRsaCipher(
|
||||
RSA_PUBLIC_KEY,
|
||||
RSA_PRIVATE_KEY,
|
||||
['tag' => 'value']
|
||||
);
|
||||
|
||||
$eclient = new Oss\EncryptionClient($client, $masterCipher);
|
||||
|
||||
// case 1: Simple Upload
|
||||
$putObjRequest = new Oss\Models\PutObjectRequest($bucket, $key);
|
||||
$putObjResult = $eclient->putObject($putObjRequest);
|
||||
printf(
|
||||
'put object status code:' . $putObjResult->statusCode . PHP_EOL .
|
||||
'request id:' . $putObjResult->requestId . PHP_EOL
|
||||
);
|
||||
|
||||
// case 2: Multipart Upload
|
||||
$initRequest = new Oss\Models\InitiateMultipartUploadRequest($bucket, $key);
|
||||
$initRequest->cseDataSize = 500 * 1024;
|
||||
$initRequest->csePartSize = 200 * 1024;
|
||||
$initResult = $eclient->initiateMultipartUpload($initRequest);
|
||||
$uploadPartRequest = new Oss\Models\UploadPartRequest($bucket, $key);
|
||||
$bigFileName = "upload.tmp";
|
||||
$partSize = 200 * 1024;
|
||||
generateFile($bigFileName, 500 * 1024);
|
||||
$file = fopen($bigFileName, 'r');
|
||||
$parts = array();
|
||||
if ($file) {
|
||||
$i = 1;
|
||||
while (!feof($file)) {
|
||||
$chunk = fread($file, $partSize);
|
||||
$uploadPartRequest = new Oss\Models\UploadPartRequest(
|
||||
$bucket,
|
||||
$key,
|
||||
$i,
|
||||
$initResult->uploadId,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
Oss\Utils::streamFor($chunk)
|
||||
);
|
||||
$uploadPartRequest->encryptionMultipartContext = $initResult->encryptionMultipartContext;
|
||||
$partResult = $eclient->uploadPart($uploadPartRequest);
|
||||
$part = new Oss\Models\UploadPart(
|
||||
$i,
|
||||
$partResult->etag,
|
||||
);
|
||||
array_push($parts, $part);
|
||||
$i++;
|
||||
}
|
||||
fclose($file);
|
||||
}
|
||||
$comResult = $eclient->completeMultipartUpload(
|
||||
new Oss\Models\CompleteMultipartUploadRequest(
|
||||
$bucket,
|
||||
$key,
|
||||
$initResult->uploadId,
|
||||
null,
|
||||
new Oss\Models\CompleteMultipartUpload(
|
||||
$parts
|
||||
),
|
||||
)
|
||||
);
|
||||
unlink($bigFileName);
|
||||
printf(
|
||||
'complete multipart upload status code:' . $comResult->statusCode . PHP_EOL .
|
||||
'complete multipart upload request id:' . $comResult->requestId . PHP_EOL .
|
||||
'complete multipart upload result:' . var_export($comResult, true)
|
||||
);
|
||||
|
||||
function generateFile($filename, $size)
|
||||
{
|
||||
if (
|
||||
file_exists($filename) &&
|
||||
$size == sprintf('%u', filesize($filename))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
$part_size = 32;
|
||||
$fp = fopen($filename, "w");
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
|
||||
$charactersLength = strlen($characters);
|
||||
if ($fp) {
|
||||
while ($size > 0) {
|
||||
if ($size < $part_size) {
|
||||
$write_size = $size;
|
||||
} else {
|
||||
$write_size = $part_size;
|
||||
}
|
||||
$size -= $write_size;
|
||||
$a = $characters[rand(0, $charactersLength - 1)];
|
||||
$content = str_repeat($a, $write_size);
|
||||
$flag = fwrite($fp, $content);
|
||||
if (!$flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
47
vendor/alibabacloud/oss-v2/sample/ExtentBucketWorm.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/ExtentBucketWorm.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"worm-id" => ['help' => 'The worm id of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$wormId = $options["worm-id"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\ExtendBucketWormRequest($bucket, $wormId, new Oss\Models\ExtendWormConfiguration(3));
|
||||
$result = $client->extendBucketWorm($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
49
vendor/alibabacloud/oss-v2/sample/GetAccessPoint.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/GetAccessPoint.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$accessPointName = 'ap-01';
|
||||
$request = new Oss\Models\GetAccessPointRequest($bucket, $accessPointName);
|
||||
$result = $client->getAccessPoint($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'get access point:' . var_export($result->getAccessPoint, true)
|
||||
);
|
||||
|
||||
49
vendor/alibabacloud/oss-v2/sample/GetAccessPointPolicy.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/GetAccessPointPolicy.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$accessPointName = 'ap-01';
|
||||
$request = new Oss\Models\GetAccessPointPolicyRequest($bucket, $accessPointName);
|
||||
$result = $client->getAccessPointPolicy($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'access point policy:' . $result->body
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetBucketAccessMonitor.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetBucketAccessMonitor.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketAccessMonitorRequest($bucket);
|
||||
$result = $client->GetBucketAccessMonitor($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'access monitor status:' . $result->accessMonitorConfiguration->status
|
||||
);
|
||||
45
vendor/alibabacloud/oss-v2/sample/GetBucketAcl.php
vendored
Normal file
45
vendor/alibabacloud/oss-v2/sample/GetBucketAcl.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketAclRequest($bucket);
|
||||
$result = $client->getBucketAcl($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'bucket acl:' . $result->accessControlList->grant
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetBucketArchiveDirectRead.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetBucketArchiveDirectRead.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketArchiveDirectReadRequest($bucket);
|
||||
$result = $client->getBucketArchiveDirectRead($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'archive direct read config:' . var_export($result->archiveDirectReadConfiguration->enabled, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketCors.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketCors.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketCorsRequest($bucket);
|
||||
$result = $client->getBucketCors($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'cors:' . var_export($result->corsConfiguration, true)
|
||||
);
|
||||
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketDataRedundancyTransition.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketDataRedundancyTransition.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"task-id" => ['help' => 'The Id of the redundancy change task.', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$taskId = $options["task-id"];
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketDataRedundancyTransitionRequest($bucket, $taskId);
|
||||
$result = $client->getBucketDataRedundancyTransition($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'bucket data redundancy transition:' . var_export($result->bucketDataRedundancyTransition, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketEncryption.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketEncryption.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketEncryptionRequest($bucket);
|
||||
$result = $client->getBucketEncryption($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'encryption:' . var_export($result->serverSideEncryptionRule, true)
|
||||
);
|
||||
|
||||
49
vendor/alibabacloud/oss-v2/sample/GetBucketHttpsConfig.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/GetBucketHttpsConfig.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketHttpsConfigRequest(
|
||||
$bucket,
|
||||
);
|
||||
$result = $client->getBucketHttpsConfig($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'https config:' . var_export($result->httpsConfiguration, true)
|
||||
);
|
||||
49
vendor/alibabacloud/oss-v2/sample/GetBucketInfo.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/GetBucketInfo.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\GetBucketInfoRequest($bucket);
|
||||
|
||||
$result = $client->getBucketInfo($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'bucket info:' . var_export($result->bucketInfo, true)
|
||||
);
|
||||
51
vendor/alibabacloud/oss-v2/sample/GetBucketInventory.php
vendored
Normal file
51
vendor/alibabacloud/oss-v2/sample/GetBucketInventory.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$inventoryId = 'test-inventory-id';
|
||||
$request = new Oss\Models\GetBucketInventoryRequest(
|
||||
$bucket,
|
||||
inventoryId: $inventoryId
|
||||
);
|
||||
$result = $client->getBucketInventory($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'inventory config:' . var_export($result->inventoryConfiguration, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketLifecycle.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketLifecycle.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketLifecycleRequest($bucket);
|
||||
$result = $client->getBucketLifecycle($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'lifecycle:' . var_export($result->lifecycleConfiguration, true)
|
||||
);
|
||||
|
||||
49
vendor/alibabacloud/oss-v2/sample/GetBucketLocation.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/GetBucketLocation.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\GetBucketLocationRequest($bucket);
|
||||
|
||||
$result = $client->getBucketLocation($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'bucket location:' . var_export($result->location, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketLogging.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketLogging.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketLoggingRequest($bucket);
|
||||
$result = $client->getBucketLogging($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'logging status:' . var_export($result->bucketLoggingStatus, true)
|
||||
);
|
||||
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketOverwrite.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketOverwrite.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketOverwriteConfigRequest($bucket);
|
||||
$result = $client->getBucketOverwriteConfig($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'overwrite config:' . var_export($result->overwriteConfiguration, true)
|
||||
);
|
||||
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketPolicy.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketPolicy.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketPolicyRequest($bucket);
|
||||
$result = $client->getBucketPolicy($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'policy:' . $result->body
|
||||
);
|
||||
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketPolicyStatus.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketPolicyStatus.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketPolicyStatusRequest($bucket);
|
||||
$result = $client->getBucketPolicyStatus($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'policy status:' . var_export($result->policyStatus->isPublic, true)
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetBucketPublicAccessBlock.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetBucketPublicAccessBlock.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketPublicAccessBlockRequest($bucket);
|
||||
$result = $client->getBucketPublicAccessBlock($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'bucket public access block config:' . var_export($result->publicAccessBlockConfiguration, true)
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetBucketReferer.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetBucketReferer.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketRefererRequest($bucket);
|
||||
$result = $client->getBucketReferer($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'referer config:' . var_export($result->refererConfiguration, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketReplication.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketReplication.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
use AlibabaCloud\Oss\V2\Models\LifecycleConfiguration;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketReplicationRequest($bucket);
|
||||
$result = $client->getBucketReplication($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'replication config:' . var_export($result->replicationConfiguration, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketReplicationLocation.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketReplicationLocation.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
use AlibabaCloud\Oss\V2\Models\LifecycleConfiguration;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketReplicationLocationRequest($bucket);
|
||||
$result = $client->getBucketReplicationLocation($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'replication location:' . var_export($result->replicationLocation, true)
|
||||
);
|
||||
50
vendor/alibabacloud/oss-v2/sample/GetBucketReplicationProgress.php
vendored
Normal file
50
vendor/alibabacloud/oss-v2/sample/GetBucketReplicationProgress.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
use AlibabaCloud\Oss\V2\Models\LifecycleConfiguration;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"rule-id" => ['help' => 'The replication rule id of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$ruleId = $options["rule-id"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketReplicationProgressRequest($bucket, $ruleId);
|
||||
$result = $client->getBucketReplicationProgress($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'replication progress:' . var_export($result->replicationProgress, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketRequestPayment.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketRequestPayment.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketRequestPaymentRequest($bucket);
|
||||
$result = $client->getBucketRequestPayment($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'request payer:' . $result->requestPaymentConfiguration->payer
|
||||
);
|
||||
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetBucketResourceGroup.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetBucketResourceGroup.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketResourceGroupRequest($bucket);
|
||||
$result = $client->getBucketResourceGroup($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'resource group id:' . var_export($result->bucketResourceGroupConfiguration->resourceGroupId, true)
|
||||
);
|
||||
49
vendor/alibabacloud/oss-v2/sample/GetBucketStat.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/GetBucketStat.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\GetBucketStatRequest($bucket);
|
||||
|
||||
$result = $client->getBucketStat($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'result:' . var_export($result, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketTags.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketTags.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketTagsRequest($bucket);
|
||||
$result = $client->getBucketTags($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'tags:' . var_export($result->tagging, true)
|
||||
);
|
||||
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketTransferAcceleration.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketTransferAcceleration.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketTransferAccelerationRequest($bucket);
|
||||
$result = $client->getBucketTransferAcceleration($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'transfer acceleration status:' . var_export($result->transferAccelerationConfiguration->enabled, true)
|
||||
);
|
||||
|
||||
45
vendor/alibabacloud/oss-v2/sample/GetBucketVersioning.php
vendored
Normal file
45
vendor/alibabacloud/oss-v2/sample/GetBucketVersioning.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketVersioningRequest($bucket);
|
||||
$result = $client->getBucketVersioning($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'version status:' . $result->versioningConfiguration->status
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketWebsite.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketWebsite.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketWebsiteRequest($bucket);
|
||||
$result = $client->getBucketWebsite($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'website config:' . var_export($result->websiteConfiguration, true)
|
||||
);
|
||||
|
||||
48
vendor/alibabacloud/oss-v2/sample/GetBucketWorm.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/GetBucketWorm.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"worm-id" => ['help' => 'The worm id of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$wormId = $options["worm-id"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetBucketWormRequest($bucket);
|
||||
$result = $client->getBucketWorm($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'worm config:' . var_export($result->wormConfiguration, true)
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetCnameToken.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetCnameToken.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetCnameTokenRequest($bucket, 'example.com');
|
||||
$result = $client->getCnameToken($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'cname token:' . var_export($result->cnameToken, true)
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetMetaQueryStatus.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetMetaQueryStatus.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetMetaQueryStatusRequest($bucket);
|
||||
$result = $client->getMetaQueryStatus($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'meta query status:' . var_export($result->metaQueryStatus, true)
|
||||
);
|
||||
51
vendor/alibabacloud/oss-v2/sample/GetObject.php
vendored
Normal file
51
vendor/alibabacloud/oss-v2/sample/GetObject.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\GetObjectRequest($bucket, $key);
|
||||
|
||||
$result = $client->getObject($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'body:' . $result->body->getContents()
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetObjectAcl.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetObjectAcl.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetObjectAclRequest($bucket, $key);
|
||||
$result = $client->getObjectAcl($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'acl:' . $result->accessControlList->grant
|
||||
);
|
||||
51
vendor/alibabacloud/oss-v2/sample/GetObjectMeta.php
vendored
Normal file
51
vendor/alibabacloud/oss-v2/sample/GetObjectMeta.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\GetObjectMetaRequest($bucket, $key);
|
||||
|
||||
$result = $client->getObjectMeta($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'result:' . var_export($result, true)
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetObjectTagging.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetObjectTagging.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetObjectTaggingRequest($bucket, $key);
|
||||
$result = $client->getObjectTagging($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'result:' . var_export($result, true)
|
||||
);
|
||||
45
vendor/alibabacloud/oss-v2/sample/GetPublicAccessBlock.php
vendored
Normal file
45
vendor/alibabacloud/oss-v2/sample/GetPublicAccessBlock.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetPublicAccessBlockRequest();
|
||||
$result = $client->getPublicAccessBlock($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'public access block config:' . var_export($result->publicAccessBlockConfiguration, true)
|
||||
);
|
||||
50
vendor/alibabacloud/oss-v2/sample/GetStyle.php
vendored
Normal file
50
vendor/alibabacloud/oss-v2/sample/GetStyle.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetStyleRequest(
|
||||
$bucket,
|
||||
styleName: 'test',
|
||||
);
|
||||
$result = $client->getStyle($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'style info:' . var_export($result->style, true)
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetSymlink.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetSymlink.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetSymlinkRequest($bucket, $key);
|
||||
$result = $client->getSymlink($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'result:' . var_export($result, true)
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/GetUserDefinedLogFieldsConfig.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/GetUserDefinedLogFieldsConfig.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\GetUserDefinedLogFieldsConfigRequest($bucket);
|
||||
$result = $client->getUserDefinedLogFieldsConfig($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId. PHP_EOL .
|
||||
'user defined log fields config:'. var_export($result->userDefinedLogFieldsConfiguration, true)
|
||||
);
|
||||
51
vendor/alibabacloud/oss-v2/sample/HeadObject.php
vendored
Normal file
51
vendor/alibabacloud/oss-v2/sample/HeadObject.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\HeadObjectRequest($bucket, $key);
|
||||
|
||||
$result = $client->headObject($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'result:' . var_export($result, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/InitiateBucketWorm.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/InitiateBucketWorm.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\InitiateBucketWormRequest($bucket, new Oss\Models\InitiateWormConfiguration(
|
||||
3
|
||||
));
|
||||
$result = $client->initiateBucketWorm($request);
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'worm id:' . $result->wormId
|
||||
);
|
||||
50
vendor/alibabacloud/oss-v2/sample/InitiateMultipartUpload.php
vendored
Normal file
50
vendor/alibabacloud/oss-v2/sample/InitiateMultipartUpload.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\InitiateMultipartUploadRequest($bucket, $key);
|
||||
$result = $client->initiateMultipartUpload($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'result:' . var_export($result, true)
|
||||
);
|
||||
98
vendor/alibabacloud/oss-v2/sample/InvokeOperation.php
vendored
Normal file
98
vendor/alibabacloud/oss-v2/sample/InvokeOperation.php
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
// PutCname sample case 1:
|
||||
$body = Oss\Utils::streamFor("<BucketCnameConfiguration>
|
||||
<Cname>
|
||||
<Domain>example.com</Domain>
|
||||
</Cname>
|
||||
</BucketCnameConfiguration>");
|
||||
|
||||
$input = new Oss\OperationInput(
|
||||
"PutCname",
|
||||
"POST",
|
||||
);
|
||||
$input->setParameter("cname", "");
|
||||
$input->setParameter("comp", "add");
|
||||
$input->setBody($body);
|
||||
$input->setBucket($bucket);
|
||||
|
||||
$result = $client->invokeOperation($input);
|
||||
printf(
|
||||
'status code:' . $result->GetStatusCode() . PHP_EOL .
|
||||
'request id:' . $result->getHeaders()["x-oss-request-id"] . PHP_EOL
|
||||
);
|
||||
|
||||
// PutCname sample case 2:
|
||||
//$body = Oss\Utils::streamFor("<BucketCnameConfiguration>
|
||||
// <Cname>
|
||||
// <Domain>example.com</Domain>
|
||||
// </Cname>
|
||||
//</BucketCnameConfiguration>");
|
||||
//
|
||||
//
|
||||
//$input = new Oss\OperationInput(
|
||||
// opName: "PutCname",
|
||||
// method: "POST",
|
||||
// headers: null,
|
||||
// parameters: ["cname" => "", "comp" => "add"],
|
||||
// body: $body,
|
||||
// bucket: $bucket
|
||||
//);
|
||||
//$result = $client->invokeOperation($input);
|
||||
//printf(
|
||||
// 'status code:' . $result->GetStatusCode() . PHP_EOL .
|
||||
// 'request id:' . $result->getHeaders()["x-oss-request-id"] . PHP_EOL
|
||||
//);
|
||||
|
||||
// GetCnameToken sample
|
||||
$input = new Oss\OperationInput(
|
||||
"GetCnameToken",
|
||||
"GET",
|
||||
null,
|
||||
["cname" => "example.com", "comp" => "token"],
|
||||
NULL,
|
||||
$bucket
|
||||
);
|
||||
$result = $client->invokeOperation($input);
|
||||
printf(
|
||||
'status code:' . $result->GetStatusCode() . PHP_EOL .
|
||||
'request id:' . $result->getHeaders()["x-oss-request-id"] . PHP_EOL .
|
||||
'body:' . $result->getBody()->getContents()
|
||||
);
|
||||
45
vendor/alibabacloud/oss-v2/sample/IsBucketExist.php
vendored
Normal file
45
vendor/alibabacloud/oss-v2/sample/IsBucketExist.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$exist = $client->isBucketExist($bucket);
|
||||
|
||||
printf(
|
||||
'bucket is exist:' . var_export($exist, true)
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/IsObjectExist.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/IsObjectExist.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$exist = $client->isObjectExist($bucket, $key);
|
||||
|
||||
printf(
|
||||
'object is exist:' . var_export($exist, true)
|
||||
);
|
||||
48
vendor/alibabacloud/oss-v2/sample/ListAccessPoint.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/ListAccessPoint.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\ListAccessPointsRequest();
|
||||
$result = $client->listAccessPoints($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'list access points:' . var_export($result->listAccessPoints, true)
|
||||
);
|
||||
|
||||
46
vendor/alibabacloud/oss-v2/sample/ListBucketDataRedundancyTransition.php
vendored
Normal file
46
vendor/alibabacloud/oss-v2/sample/ListBucketDataRedundancyTransition.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\ListBucketDataRedundancyTransitionRequest($bucket);
|
||||
$result = $client->listBucketDataRedundancyTransition($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'bucket data redundancy transitions:' . var_export($result->listBucketDataRedundancyTransition->bucketDataRedundancyTransitions, true)
|
||||
);
|
||||
49
vendor/alibabacloud/oss-v2/sample/ListBucketInventory.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/ListBucketInventory.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\ListBucketInventoryRequest(
|
||||
$bucket,
|
||||
);
|
||||
$result = $client->listBucketInventory($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'list inventory config:' . var_export($result->listInventoryConfigurationsResult->inventoryConfigurations, true)
|
||||
);
|
||||
46
vendor/alibabacloud/oss-v2/sample/ListBuckets.php
vendored
Normal file
46
vendor/alibabacloud/oss-v2/sample/ListBuckets.php
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help'=>'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help'=>'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
];
|
||||
$longopts = \array_map(function($key){return "$key:";}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
// Create the Paginator for the ListBuckets operation
|
||||
$paginator = new Oss\Paginator\ListBucketsPaginator($client);
|
||||
$iter = $paginator->iterPage(new Oss\Models\ListBucketsRequest());
|
||||
|
||||
// Iterate through the bucket pages
|
||||
foreach ($iter as $page) {
|
||||
foreach ($page->buckets ?? [] as $bucket) {
|
||||
print ("Bucket: $bucket->name, $bucket->location\n");
|
||||
}
|
||||
}
|
||||
47
vendor/alibabacloud/oss-v2/sample/ListCloudBoxes.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/ListCloudBoxes.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$request = new Oss\Models\ListCloudBoxesRequest();
|
||||
|
||||
$result = $client->listCloudBoxes($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'list cloud box:' . var_export($result->listCloudBoxes, true)
|
||||
);
|
||||
47
vendor/alibabacloud/oss-v2/sample/ListCname.php
vendored
Normal file
47
vendor/alibabacloud/oss-v2/sample/ListCname.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\ListCnameRequest($bucket);
|
||||
$result = $client->listCname($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'cnames:' . var_export($result->cnames, true)
|
||||
);
|
||||
51
vendor/alibabacloud/oss-v2/sample/ListMultipartUploads.php
vendored
Normal file
51
vendor/alibabacloud/oss-v2/sample/ListMultipartUploads.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
// Create the Paginator for the ListBuckets operation
|
||||
$paginator = new Oss\Paginator\ListMultipartUploadsPaginator($client);
|
||||
$iter = $paginator->iterPage(new Oss\Models\ListMultipartUploadsRequest($bucket));
|
||||
|
||||
// Iterate through the bucket pages
|
||||
foreach ($iter as $page) {
|
||||
foreach ($page->uploads ?? [] as $upload) {
|
||||
printf(
|
||||
'upload:' . var_export($upload, true) . PHP_EOL
|
||||
);
|
||||
}
|
||||
}
|
||||
50
vendor/alibabacloud/oss-v2/sample/ListObjectVersions.php
vendored
Normal file
50
vendor/alibabacloud/oss-v2/sample/ListObjectVersions.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
# Create the Paginator for the ListBuckets operation
|
||||
$paginator = new Oss\Paginator\ListObjectVersionsPaginator($client);
|
||||
$iter = $paginator->iterPage(new Oss\Models\ListObjectVersionsRequest($bucket));
|
||||
|
||||
// Iterate through the object pages
|
||||
foreach ($iter as $page) {
|
||||
foreach ($page->versions ?? [] as $version) {
|
||||
print("Object: $version->key, $version->type, $version->size,$version->versionId \n");
|
||||
}
|
||||
}
|
||||
50
vendor/alibabacloud/oss-v2/sample/ListObjects.php
vendored
Normal file
50
vendor/alibabacloud/oss-v2/sample/ListObjects.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
# Create the Paginator for the ListBuckets operation
|
||||
$paginator = new Oss\Paginator\ListObjectsPaginator($client);
|
||||
$iter = $paginator->iterPage(new Oss\Models\ListObjectsRequest($bucket));
|
||||
|
||||
// Iterate through the object pages
|
||||
foreach ($iter as $page) {
|
||||
foreach ($page->contents ?? [] as $object) {
|
||||
print("Object: $object->key, $object->type, $object->size\n");
|
||||
}
|
||||
}
|
||||
48
vendor/alibabacloud/oss-v2/sample/ListObjectsV2.php
vendored
Normal file
48
vendor/alibabacloud/oss-v2/sample/ListObjectsV2.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help'=>'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help'=>'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help'=>'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function($key){return "$key:";}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
# Create the Paginator for the ListBuckets operation
|
||||
$paginator = new Oss\Paginator\ListObjectsV2Paginator($client);
|
||||
$iter = $paginator->iterPage(new Oss\Models\ListObjectsV2Request($bucket));
|
||||
|
||||
// Iterate through the object pages
|
||||
foreach ($iter as $page) {
|
||||
foreach ($page->contents ?? [] as $object) {
|
||||
print("Object: $object->key, $object->type, $object->size\n");
|
||||
}
|
||||
}
|
||||
55
vendor/alibabacloud/oss-v2/sample/ListParts.php
vendored
Normal file
55
vendor/alibabacloud/oss-v2/sample/ListParts.php
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
"upload-id" => ['help' => 'The upload id', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
$uploadId = $options["upload-id"];
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
// Create the Paginator for the ListBuckets operation
|
||||
$paginator = new Oss\Paginator\ListPartsPaginator($client);
|
||||
$iter = $paginator->iterPage(new Oss\Models\ListPartsRequest($bucket, $key, $uploadId));
|
||||
|
||||
// Iterate through the bucket pages
|
||||
foreach ($iter as $page) {
|
||||
foreach ($page->parts ?? [] as $part) {
|
||||
printf(
|
||||
'part:' . var_export($part, true) . PHP_EOL
|
||||
);
|
||||
}
|
||||
}
|
||||
49
vendor/alibabacloud/oss-v2/sample/ListStyle.php
vendored
Normal file
49
vendor/alibabacloud/oss-v2/sample/ListStyle.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\ListStyleRequest(
|
||||
$bucket,
|
||||
);
|
||||
$result = $client->listStyle($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'styles:' . var_export($result->styleList->styles, true)
|
||||
);
|
||||
44
vendor/alibabacloud/oss-v2/sample/ListUserDataRedundancyTransition.php
vendored
Normal file
44
vendor/alibabacloud/oss-v2/sample/ListUserDataRedundancyTransition.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
$request = new Oss\Models\ListUserDataRedundancyTransitionRequest();
|
||||
$result = $client->listUserDataRedundancyTransition($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId . PHP_EOL .
|
||||
'bucket data redundancy transitions:' . var_export($result->listBucketDataRedundancyTransition->bucketDataRedundancyTransitions, true)
|
||||
);
|
||||
57
vendor/alibabacloud/oss-v2/sample/OpenMetaQuery.php
vendored
Normal file
57
vendor/alibabacloud/oss-v2/sample/OpenMetaQuery.php
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
// case 1: meta search
|
||||
$request = new Oss\Models\OpenMetaQueryRequest($bucket);
|
||||
$result = $client->openMetaQuery($request);
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
|
||||
// case 2: ai search
|
||||
//$request = new Oss\Models\OpenMetaQueryRequest($bucket,'semantic');
|
||||
//$result = $client->openMetaQuery($request);
|
||||
//
|
||||
//printf(
|
||||
// 'status code:' . $result->statusCode . PHP_EOL .
|
||||
// 'request id:' . $result->requestId
|
||||
//);
|
||||
53
vendor/alibabacloud/oss-v2/sample/OptionObject.php
vendored
Normal file
53
vendor/alibabacloud/oss-v2/sample/OptionObject.php
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use AlibabaCloud\Oss\V2 as Oss;
|
||||
|
||||
// parse args
|
||||
$optsdesc = [
|
||||
"region" => ['help' => 'The region in which the bucket is located.', 'required' => True],
|
||||
"endpoint" => ['help' => 'The domain names that other services can use to access OSS.', 'required' => False],
|
||||
"bucket" => ['help' => 'The name of the bucket', 'required' => True],
|
||||
"key" => ['help' => 'The name of the object', 'required' => True],
|
||||
];
|
||||
$longopts = \array_map(function ($key) {
|
||||
return "$key:";
|
||||
}, array_keys($optsdesc));
|
||||
$options = getopt("", $longopts);
|
||||
foreach ($optsdesc as $key => $value) {
|
||||
if ($value['required'] === True && empty($options[$key])) {
|
||||
$help = $value['help'];
|
||||
echo "Error: the following arguments are required: --$key, $help";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
$region = $options["region"];
|
||||
$bucket = $options["bucket"];
|
||||
$key = $options["key"];
|
||||
|
||||
// Loading credentials values from the environment variables
|
||||
$credentialsProvider = new Oss\Credentials\EnvironmentVariableCredentialsProvider();
|
||||
|
||||
// Using the SDK's default configuration
|
||||
$cfg = Oss\Config::loadDefault();
|
||||
$cfg->setCredentialsProvider($credentialsProvider);
|
||||
$cfg->setRegion($region);
|
||||
if (isset($options["endpoint"])) {
|
||||
$cfg->setEndpoint($options["endpoint"]);
|
||||
}
|
||||
|
||||
$client = new Oss\Client($cfg);
|
||||
|
||||
$result = $client->optionObject(new Oss\Models\OptionObjectRequest(
|
||||
$bucket,
|
||||
$key,
|
||||
origin: 'http://www.example.com',
|
||||
accessControlRequestMethod: 'PUT',
|
||||
));
|
||||
|
||||
printf(
|
||||
'status code:' . $result->statusCode . PHP_EOL .
|
||||
'request id:' . $result->requestId
|
||||
);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user