| 1 |
<?php |
| 2 |
|
| 3 |
namespace Aws\S3\S3Transfer\Models; |
| 4 |
|
| 5 |
final class S3TransferManagerConfig |
| 6 |
{ |
| 7 |
public const DEFAULT_TARGET_PART_SIZE_BYTES = 8388608; |
| 8 |
public const DEFAULT_MULTIPART_UPLOAD_THRESHOLD_BYTES = 16777216; |
| 9 |
public const DEFAULT_REQUEST_CHECKSUM_CALCULATION = 'when_supported'; |
| 10 |
public const DEFAULT_RESPONSE_CHECKSUM_VALIDATION = 'when_supported'; |
| 11 |
public const DEFAULT_MULTIPART_DOWNLOAD_TYPE = 'part'; |
| 12 |
public const DEFAULT_CONCURRENCY = 5; |
| 13 |
private const DEFAULT_TRACK_PROGRESS = false; |
| 14 |
|
| 15 |
|
| 16 |
private int $targetPartSizeBytes; |
| 17 |
|
| 18 |
|
| 19 |
private int $multipartUploadThresholdBytes; |
| 20 |
|
| 21 |
|
| 22 |
private string $requestChecksumCalculation; |
| 23 |
|
| 24 |
|
| 25 |
private string $responseChecksumValidation; |
| 26 |
|
| 27 |
|
| 28 |
private string $multipartDownloadType; |
| 29 |
|
| 30 |
|
| 31 |
private int $concurrency; |
| 32 |
|
| 33 |
|
| 34 |
private bool $trackProgress; |
| 35 |
|
| 36 |
|
| 37 |
private ?string $defaultRegion; |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
public function __construct( |
| 50 |
int $targetPartSizeBytes, |
| 51 |
int $multipartUploadThresholdBytes, |
| 52 |
string $requestChecksumCalculation, |
| 53 |
string $responseChecksumValidation, |
| 54 |
string $multipartDownloadType, |
| 55 |
int $concurrency, |
| 56 |
bool $trackProgress, |
| 57 |
?string $defaultRegion |
| 58 |
) { |
| 59 |
$this->targetPartSizeBytes = $targetPartSizeBytes; |
| 60 |
$this->multipartUploadThresholdBytes = $multipartUploadThresholdBytes; |
| 61 |
$this->requestChecksumCalculation = $requestChecksumCalculation; |
| 62 |
$this->responseChecksumValidation = $responseChecksumValidation; |
| 63 |
$this->multipartDownloadType = $multipartDownloadType; |
| 64 |
$this->concurrency = $concurrency; |
| 65 |
$this->trackProgress = $trackProgress; |
| 66 |
$this->defaultRegion = $defaultRegion; |
| 67 |
} |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
public static function fromArray(array $config): self { |
| 88 |
return new self( |
| 89 |
$config['target_part_size_bytes'] |
| 90 |
?? self::DEFAULT_TARGET_PART_SIZE_BYTES, |
| 91 |
$config['multipart_upload_threshold_bytes'] |
| 92 |
?? self::DEFAULT_MULTIPART_UPLOAD_THRESHOLD_BYTES, |
| 93 |
$config['request_checksum_calculation'] |
| 94 |
?? self::DEFAULT_REQUEST_CHECKSUM_CALCULATION, |
| 95 |
$config['response_checksum_validation'] |
| 96 |
?? self::DEFAULT_RESPONSE_CHECKSUM_VALIDATION, |
| 97 |
$config['multipart_download_type'] |
| 98 |
?? self::DEFAULT_MULTIPART_DOWNLOAD_TYPE, |
| 99 |
$config['concurrency'] |
| 100 |
?? self::DEFAULT_CONCURRENCY, |
| 101 |
$config['track_progress'] ?? self::DEFAULT_TRACK_PROGRESS, |
| 102 |
$config['default_region'] ?? null |
| 103 |
); |
| 104 |
} |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
public function getTargetPartSizeBytes(): int |
| 110 |
{ |
| 111 |
return $this->targetPartSizeBytes; |
| 112 |
} |
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
public function getMultipartUploadThresholdBytes(): int |
| 118 |
{ |
| 119 |
return $this->multipartUploadThresholdBytes; |
| 120 |
} |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
public function getRequestChecksumCalculation(): string |
| 126 |
{ |
| 127 |
return $this->requestChecksumCalculation; |
| 128 |
} |
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
public function getResponseChecksumValidation(): string |
| 134 |
{ |
| 135 |
return $this->responseChecksumValidation; |
| 136 |
} |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
public function getMultipartDownloadType(): string |
| 142 |
{ |
| 143 |
return $this->multipartDownloadType; |
| 144 |
} |
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
public function getConcurrency(): int |
| 150 |
{ |
| 151 |
return $this->concurrency; |
| 152 |
} |
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
public function isTrackProgress(): bool |
| 158 |
{ |
| 159 |
return $this->trackProgress; |
| 160 |
} |
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
public function getDefaultRegion(): ?string |
| 166 |
{ |
| 167 |
return $this->defaultRegion; |
| 168 |
} |
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
public function toArray(): array |
| 174 |
{ |
| 175 |
return [ |
| 176 |
'target_part_size_bytes' => $this->targetPartSizeBytes, |
| 177 |
'multipart_upload_threshold_bytes' => $this->multipartUploadThresholdBytes, |
| 178 |
'request_checksum_calculation' => $this->requestChecksumCalculation, |
| 179 |
'response_checksum_validation' => $this->responseChecksumValidation, |
| 180 |
'multipart_download_type' => $this->multipartDownloadType, |
| 181 |
'concurrency' => $this->concurrency, |
| 182 |
'track_progress' => $this->trackProgress, |
| 183 |
'default_region' => $this->defaultRegion, |
| 184 |
]; |
| 185 |
} |
| 186 |
} |