1
0
This repository has been archived on 2026-04-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
yii2-aws-s3/src/commands/RestoreCommand.php
2016-10-08 00:17:22 +06:00

127 lines
2.4 KiB
PHP

<?php
namespace frostealth\yii2\aws\s3\commands;
use Aws\ResultInterface;
use frostealth\yii2\aws\s3\base\commands\ExecutableCommand;
use frostealth\yii2\aws\s3\base\commands\traits\Async;
use frostealth\yii2\aws\s3\interfaces\commands\Asynchronous;
use frostealth\yii2\aws\s3\interfaces\commands\HasBucket;
use frostealth\yii2\aws\s3\interfaces\commands\PlainCommand;
use GuzzleHttp\Promise\PromiseInterface;
/**
* Class RestoreCommand
*
* @method ResultInterface|PromiseInterface execute()
*
* @package frostealth\yii2\aws\s3\commands
*/
class RestoreCommand extends ExecutableCommand implements PlainCommand, HasBucket, Asynchronous
{
use Async;
/** @var array */
protected $args = [];
/**
* @return string
*/
public function getBucket(): string
{
return $this->args['Bucket'] ?? '';
}
/**
* @param string $name
*
* @return $this
*/
public function inBucket(string $name)
{
$this->args['Bucket'] = $name;
return $this;
}
/**
* @return string
*/
public function getFilename(): string
{
return $this->args['Key'] ?? '';
}
/**
* @param string $filename
*
* @return $this
*/
public function byFilename(string $filename)
{
$this->args['Key'] = $filename;
return $this;
}
/**
* @return int lifetime of the active copy in days
*/
public function getLifetime(): int
{
return $this->args['Days'] ?? 0;
}
/**
* @param int $days lifetime of the active copy in days
*
* @return $this
*/
public function withLifetime(int $days)
{
$this->args['Days'] = $days;
return $this;
}
/**
* @return string
*/
public function getVersionId(): string
{
return $this->args['VersionId'] ?? '';
}
/**
* @param string $versionId
*
* @return $this
*/
public function withVersionId(string $versionId)
{
$this->args['VersionId'] = $versionId;
return $this;
}
/**
* @internal used by the handlers
*
* @return string
*/
public function getName(): string
{
return 'RestoreObject';
}
/**
* @internal used by the handlers
*
* @return array
*/
public function toArgs(): array
{
return $this->args;
}
}