Search files via PHP SDK filtering with limit and date

0

I need to search files on AWS S3 storage using some filter:

  • range date
  • storage class
  • num max items

I'm using "aws/aws-sdk-php" : "^3.239" library

$objects = $this->client->getIterator('ListObjects', [
				'Bucket' => S3_BUCKET_NAME,
				'Prefix' => $folder,
				'MaxKeys' => 10,	// NOT WORKS
				'StorageClass' => "STANDARD"	// NOT WORKS
		]);

		foreach ($objects as $object) {	
			...
		}

Could you please support me?

Thanks L

luk3tt0
feita há 2 anos564 visualizações
1 Resposta
0

The Iterator method is for the php V2. If you are using PHP V3, could you try with the paginator. A Paginator is essentially an iterator of results. They are created via the getPaginator() method of the client.

Resources for review: [1]: https://docs.aws.amazon.com/zh_cn/aws-sdk-php/guide/latest/guide/paginators.html [2]: https://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.AwsClientInterface.html#_getPaginator [3]: https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-s3-2006-03-01.html#listobjects

AWS
respondido há 2 anos

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas