I'm trying to get a list of objects from AWS using the S3fsService from the S3 File System module from within a hook_cron()
implementation. The following code works:
// Fetch list of files in S3.
$config = \Drupal::config('s3fs.settings')->get();
$s3 = \Drupal\s3fs\S3fsService::getAmazonS3Client($config);
$iterator_args = ['Bucket' => $config['bucket']];
$iterator = $s3->getIterator('ListObjectVersions', $iterator_args);
…but I'm getting a message saying Deprecated function: Non-static method Drupal\s3fs\S3fsService::getAmazonS3Client() should not be called statically…
.
How should I be calling it differently?
Thanks!