presignedUrl method
Generate a generic presigned URL which can be used for HTTP methods GET, PUT, HEAD and DELETE
method
: name of the HTTP methodbucketName
: name of the bucketobjectName
: name of the objectexpires
: expiry in seconds (optional, default 7 days)reqParams
: request parameters (optional)requestDate
: A date object, the url will be issued at (optional)
Implementation
Future<String> presignedUrl(
String method,
String bucket,
String object, {
int? expires,
String? resource,
Map<String, String>? reqParams,
DateTime? requestDate,
}) async {
MinioInvalidBucketNameError.check(bucket);
MinioInvalidObjectNameError.check(object);
if (expires != null && expires < 0) {
throw MinioInvalidArgumentError('invalid expire time value: $expires');
}
expires ??= expires = 24 * 60 * 60 * 7; // 7 days in seconds
reqParams ??= {};
requestDate ??= DateTime.now().toUtc();
final region = await getBucketRegion(bucket);
final request = _client.getBaseRequest(
method,
bucket,
object,
region,
resource,
reqParams,
{},
null,
);
return presignSignatureV4(this, request, region, requestDate, expires);
}