Esempio n. 1
0
 /**
  * Run backup
  *
  * @param null|string $data
  * @return bool
  * @throws PermissionException
  * @throws RuntimeException
  */
 public function backup($data = null)
 {
     $filename = $this->getFilename();
     $configuration = $this->options->get('credentials');
     $client = new S3Client(['credentials' => ['key' => $configuration['key'], 'secret' => $configuration['secret']], 'region' => $configuration['region'], 'version' => 'latest']);
     $adapter = new AwsS3Adapter($client, $configuration['bucket']);
     $config = new \League\Flysystem\Config(['mimetype' => 'application/octet-stream']);
     if (!$adapter->write($this->getPath() . $filename, $data, $config)) {
         throw new RunTimeException('Please check your configuration for Amazon s3');
     }
     return true;
 }
 /**
  * Normalize the object result array.
  *
  * @param array $response
  *
  * @return array
  */
 protected function normalizeResponse(array $response, $path = null)
 {
     $result = parent::normalizeResponse($response, $path);
     if (isset($response['Metadata']) && is_array($response['Metadata'])) {
         $result = array_merge($result, $response['Metadata']);
     }
     return $result;
 }
Esempio n. 3
0
 public function getTest2(AwsS3Adapter $cloud)
 {
     $cloud->write('', 'test5.txt', 'to fix I am using aws s31');
     //$cloud->get(), append(), files()
     return 'done';
 }
Esempio n. 4
0
 /**
  * @param AwsS3Adapter $adapter
  * @param string $path
  * @return string
  */
 public function resolve(AwsS3Adapter $adapter, $path)
 {
     return $adapter->getClient()->getObjectUrl(config('filesystems.disks.s3.bucket'), ltrim($path, '/'));
 }
 public function __construct()
 {
     $s3Client = new S3Client(['credentials' => ['key' => $this->findAwsKey(), 'secret' => $this->findAwsSecret()], 'region' => $this->findAwsRegion(), 'version' => 'latest']);
     parent::__construct($s3Client, $this->findAwsBucket(), 'protected');
 }