|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* This file is part of the Micro framework package. |
|
7
|
|
|
* |
|
8
|
|
|
* (c) Stanislau Komar <[email protected]> |
|
9
|
|
|
* |
|
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
11
|
|
|
* file that was distributed with this source code. |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
namespace Micro\Plugin\Filesystem\Adapter\Aws\Configuration\Adapter; |
|
15
|
|
|
|
|
16
|
|
|
use Micro\Plugin\Filesystem\Configuration\Adapter\AbstractFilesystemAdapterConfiguration; |
|
17
|
|
|
|
|
18
|
|
|
class AwsS3AdapterConfiguration extends AbstractFilesystemAdapterConfiguration implements AwsS3AdapterConfigurationInterface |
|
19
|
|
|
{ |
|
20
|
|
|
public const CFG_BUCKET = 'MICRO_FS_%s_BUCKET'; |
|
21
|
|
|
public const CFG_REGION = 'MICRO_FS_%s_REGION'; |
|
22
|
|
|
public const CFG_RETRIES = 'MICRO_FS_%s_RETRIES'; |
|
23
|
|
|
public const CFG_SCHEME = 'MICRO_FS_%s_SCHEME'; |
|
24
|
|
|
public const CFG_SIGNATURE_VERSION = 'MICRO_FS_%s_SIGNATURE_VERSION'; |
|
25
|
|
|
public const CFG_IS_USE_SHARED_CONFIG = 'MICRO_FS_%s_IS_USE_SHARED_CONFIG'; |
|
26
|
|
|
public const CFG_VALIDATOR_OPT_REQUIRED = 'MICRO_FS_%s_VALIDATE_REQUIRED'; |
|
27
|
|
|
public const CFG_VALIDATOR_OPT_MIN = 'MICRO_FS_%s_VALIDATE_MIN'; |
|
28
|
|
|
public const CFG_VALIDATOR_OPT_MAX = 'MICRO_FS_%s_VALIDATE_MAX'; |
|
29
|
|
|
public const CFG_VALIDATOR_OPT_PATTERN = 'MICRO_FS_%s_VALIDATE_PATTERN'; |
|
30
|
|
|
public const CFG_VERSION = 'MICRO_FS_%s_VERSION'; |
|
31
|
|
|
public const CFG_KEY_SECRET = 'MICRO_FS_%s_KEY_SECRET'; |
|
32
|
|
|
public const CFG_KEY_ACCESS = 'MICRO_FS_%s_KEY_ACCESS'; |
|
33
|
|
|
public const CFG_ENDPOINT = 'MICRO_FS_%s_ENDPOINT'; |
|
34
|
|
|
|
|
35
|
1 |
|
public function getEndpoint(): null|string |
|
36
|
|
|
{ |
|
37
|
1 |
|
return $this->get(self::CFG_ENDPOINT); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
1 |
|
public function getRegion(): string |
|
41
|
|
|
{ |
|
42
|
1 |
|
return (string) $this->get(self::CFG_REGION, null, false); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
1 |
|
public function getRetries(): int |
|
46
|
|
|
{ |
|
47
|
1 |
|
return (int) $this->get(self::CFG_RETRIES, 3); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
1 |
|
public function getScheme(): string |
|
51
|
|
|
{ |
|
52
|
1 |
|
return (string) $this->get(self::CFG_SCHEME, 'https'); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
1 |
|
public function getSignatureVersion(): string |
|
56
|
|
|
{ |
|
57
|
1 |
|
return (string) $this->get(self::CFG_SIGNATURE_VERSION, 'v4'); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
1 |
|
public function getUserAgentParameters(): array |
|
61
|
|
|
{ |
|
62
|
1 |
|
return []; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
1 |
|
public function isUseSharedConfigFile(): bool |
|
66
|
|
|
{ |
|
67
|
1 |
|
return (bool) $this->get(self::CFG_IS_USE_SHARED_CONFIG, true); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
1 |
|
public function getValidatorOptionRequired(): bool |
|
71
|
|
|
{ |
|
72
|
1 |
|
return (bool) $this->get(self::CFG_VALIDATOR_OPT_REQUIRED, false); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
1 |
|
public function getValidatorOptionMin(): int |
|
76
|
|
|
{ |
|
77
|
1 |
|
return (int) $this->get(self::CFG_VALIDATOR_OPT_MIN, 0); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
1 |
|
public function getValidatorOptionMax(): int |
|
81
|
|
|
{ |
|
82
|
1 |
|
return (int) $this->get(self::CFG_VALIDATOR_OPT_MAX, 0); |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
1 |
|
public function getValidatorOptionPattern(): null|string |
|
86
|
|
|
{ |
|
87
|
1 |
|
return $this->get(self::CFG_VALIDATOR_OPT_PATTERN); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
1 |
|
public function getVersion(): string |
|
91
|
|
|
{ |
|
92
|
1 |
|
return $this->get(self::CFG_VERSION, 'latest', false); |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
1 |
|
public function getBucket(): string |
|
96
|
|
|
{ |
|
97
|
1 |
|
return $this->get(self::CFG_BUCKET, null, false); |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
1 |
|
public function getKeyAccess(): string |
|
101
|
|
|
{ |
|
102
|
1 |
|
return $this->get(self::CFG_KEY_ACCESS, null, false); |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
1 |
|
public function getKeySecret(): string |
|
106
|
|
|
{ |
|
107
|
1 |
|
return $this->get(self::CFG_KEY_SECRET, null, false); |
|
108
|
|
|
} |
|
109
|
|
|
} |
|
110
|
|
|
|