Skip to content

add bucket redundancy transition api #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions sample/CreateBucketDataRedundancyTransition.php
Original file line number Diff line number Diff line change
@@ -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
);
47 changes: 47 additions & 0 deletions sample/DeleteBucketDataRedundancyTransition.php
Original file line number Diff line number Diff line change
@@ -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
);
48 changes: 48 additions & 0 deletions sample/GetBucketDataRedundancyTransition.php
Original file line number Diff line number Diff line change
@@ -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)
);
46 changes: 46 additions & 0 deletions sample/ListBucketDataRedundancyTransition.php
Original file line number Diff line number Diff line change
@@ -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)
);
44 changes: 44 additions & 0 deletions sample/ListUserDataRedundancyTransition.php
Original file line number Diff line number Diff line change
@@ -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)
);
10 changes: 10 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,16 @@
* @method \GuzzleHttp\Promise\Promise putBucketPublicAccessBlockAsync(Models\PutBucketPublicAccessBlockRequest $request, array $args = []) Enables or disables Block Public Access for a bucket.
* @method Models\DeleteBucketPublicAccessBlockResult deleteBucketPublicAccessBlock(Models\DeleteBucketPublicAccessBlockRequest $request, array $args = []) Deletes the Block Public Access configurations of a bucket.
* @method \GuzzleHttp\Promise\Promise deleteBucketPublicAccessBlockAsync(Models\DeleteBucketPublicAccessBlockRequest $request, array $args = []) Deletes the Block Public Access configurations of a bucket.
* @method Models\ListBucketDataRedundancyTransitionResult listBucketDataRedundancyTransition(Models\ListBucketDataRedundancyTransitionRequest $request, array $args = []) Lists all redundancy type conversion tasks of a bucket.
* @method \GuzzleHttp\Promise\Promise listBucketDataRedundancyTransitionAsync(Models\ListBucketDataRedundancyTransitionRequest $request, array $args = []) Lists all redundancy type conversion tasks of a bucket.
* @method Models\ListUserDataRedundancyTransitionResult listUserDataRedundancyTransition(Models\ListUserDataRedundancyTransitionRequest $request, array $args = []) Lists all redundancy type conversion tasks.
* @method \GuzzleHttp\Promise\Promise listUserDataRedundancyTransitionAsync(Models\ListUserDataRedundancyTransitionRequest $request, array $args = []) Lists all redundancy type conversion tasks.
* @method Models\GetBucketDataRedundancyTransitionResult getBucketDataRedundancyTransition(Models\GetBucketDataRedundancyTransitionRequest $request, array $args = []) Queries the redundancy type conversion tasks of a bucket.
* @method \GuzzleHttp\Promise\Promise getBucketDataRedundancyTransitionAsync(Models\GetBucketDataRedundancyTransitionRequest $request, array $args = []) Queries the redundancy type conversion tasks of a bucket.
* @method Models\CreateBucketDataRedundancyTransitionResult createBucketDataRedundancyTransition(Models\CreateBucketDataRedundancyTransitionRequest $request, array $args = []) Creates a redundancy type conversion task for a bucket.
* @method \GuzzleHttp\Promise\Promise createBucketDataRedundancyTransitionAsync(Models\CreateBucketDataRedundancyTransitionRequest $request, array $args = []) Creates a redundancy type conversion task for a bucket.
* @method Models\DeleteBucketDataRedundancyTransitionResult deleteBucketDataRedundancyTransition(Models\DeleteBucketDataRedundancyTransitionRequest $request, array $args = []) Deletes a redundancy type conversion task of a bucket.
* @method \GuzzleHttp\Promise\Promise deleteBucketDataRedundancyTransitionAsync(Models\DeleteBucketDataRedundancyTransitionRequest $request, array $args = []) Deletes a redundancy type conversion task of a bucket.
* @method Models\GetBucketHttpsConfigResult getBucketHttpsConfig(Models\GetBucketHttpsConfigRequest $request, array $args = []) Queries the Transport Layer Security (TLS) version configurations of a bucket.
* @method \GuzzleHttp\Promise\Promise getBucketHttpsConfigAsync(Models\GetBucketHttpsConfigRequest $request, array $args = []) Queries the Transport Layer Security (TLS) version configurations of a bucket.
* @method Models\PutBucketHttpsConfigResult putBucketHttpsConfig(Models\PutBucketHttpsConfigRequest $request, array $args = []) Enables or disables Transport Layer Security (TLS) version management for a bucket.
Expand Down
106 changes: 106 additions & 0 deletions src/Models/BucketDataRedundancyTransition.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?php

declare(strict_types=1);

namespace AlibabaCloud\Oss\V2\Models;

use AlibabaCloud\Oss\V2\Types\Model;
use AlibabaCloud\Oss\V2\Annotation\XmlElement;
use AlibabaCloud\Oss\V2\Annotation\XmlRoot;

/**
* Class BucketDataRedundancyTransition
* @package AlibabaCloud\Oss\V2\Models
*/
#[XmlRoot(name: 'BucketDataRedundancyTransition')]
final class BucketDataRedundancyTransition extends Model
{

/**
* The progress of the redundancy type change task in percentage. Valid values: 0 to 100. This element is available when the task is in the Processing or Finished state.
* @var int|null
*/
#[XmlElement(rename: 'ProcessPercentage', type: 'int')]
public ?int $processPercentage;

/**
* The estimated period of time that is required for the redundancy type change task. Unit: hours. This element is available when the task is in the Processing or Finished state.
* @var int|null
*/
#[XmlElement(rename: 'EstimatedRemainingTime', type: 'int')]
public ?int $estimatedRemainingTime;

/**
* The name of the bucket.
* @var string|null
*/
#[XmlElement(rename: 'Bucket', type: 'string')]
public ?string $bucket;

/**
* The ID of the redundancy type conversion task. The ID can be used to view and delete the redundancy type conversion task.
* @var string|null
*/
#[XmlElement(rename: 'TaskId', type: 'string')]
public ?string $taskId;

/**
* The state of the redundancy type change task. Valid values:QueueingProcessingFinished
* @var string|null
*/
#[XmlElement(rename: 'Status', type: 'string')]
public ?string $status;

/**
* The time when the redundancy type change task was created.
* @var string|null
*/
#[XmlElement(rename: 'CreateTime', type: 'string')]
public ?string $createTime;

/**
* The time when the redundancy type change task was performed. This element is available when the task is in the Processing or Finished state.
* @var string|null
*/
#[XmlElement(rename: 'StartTime', type: 'string')]
public ?string $startTime;

/**
* The time when the redundancy type change task was finished. This element is available when the task is in the Finished state.
* @var string|null
*/
#[XmlElement(rename: 'EndTime', type: 'string')]
public ?string $endTime;

/**
* BucketDataRedundancyTransition constructor.
* @param int|null $processPercentage The progress of the redundancy type change task in percentage.
* @param int|null $estimatedRemainingTime The estimated period of time that is required for the redundancy type change task.
* @param string|null $bucket The name of the bucket.
* @param string|null $taskId The ID of the redundancy type conversion task.
* @param string|null $status The state of the redundancy type change task.
* @param string|null $createTime The time when the redundancy type change task was created.
* @param string|null $startTime The time when the redundancy type change task was performed.
* @param string|null $endTime The time when the redundancy type change task was finished.
*/
public function __construct(
?int $processPercentage = null,
?int $estimatedRemainingTime = null,
?string $bucket = null,
?string $taskId = null,
?string $status = null,
?string $createTime = null,
?string $startTime = null,
?string $endTime = null
)
{
$this->processPercentage = $processPercentage;
$this->estimatedRemainingTime = $estimatedRemainingTime;
$this->bucket = $bucket;
$this->status = $status;
$this->taskId = $taskId;
$this->createTime = $createTime;
$this->startTime = $startTime;
$this->endTime = $endTime;
}
}
Loading