1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
// --------------------------------------------------------------------- |
4
|
|
|
// |
5
|
|
|
// Copyright (C) 2018-2024 Artem Rodygin |
6
|
|
|
// |
7
|
|
|
// You should have received a copy of the MIT License along with |
8
|
|
|
// this file. If not, see <https://opensource.org/licenses/MIT>. |
9
|
|
|
// |
10
|
|
|
// --------------------------------------------------------------------- |
11
|
|
|
|
12
|
|
|
namespace Linode\Managed\Repository; |
13
|
|
|
|
14
|
|
|
use Linode\Entity; |
15
|
|
|
use Linode\Internal\AbstractRepository; |
16
|
|
|
use Linode\Managed\ManagedLinodeSettings; |
17
|
|
|
use Linode\Managed\ManagedLinodeSettingsRepositoryInterface; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @codeCoverageIgnore This class was autogenerated. |
21
|
|
|
*/ |
22
|
|
|
class ManagedLinodeSettingsRepository extends AbstractRepository implements ManagedLinodeSettingsRepositoryInterface |
23
|
|
|
{ |
24
|
|
|
public function updateManagedLinodeSetting(int $linodeId, array $parameters = []): ManagedLinodeSettings |
25
|
|
|
{ |
26
|
|
|
$response = $this->client->put(sprintf('%s/%s', $this->getBaseUri(), $linodeId), $parameters); |
27
|
|
|
$contents = $response->getBody()->getContents(); |
28
|
|
|
$json = json_decode($contents, true); |
29
|
|
|
|
30
|
|
|
return new ManagedLinodeSettings($this->client, $json); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
protected function getBaseUri(): string |
34
|
|
|
{ |
35
|
|
|
return '/managed/linode-settings'; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
protected function getSupportedFields(): array |
39
|
|
|
{ |
40
|
|
|
return [ |
41
|
|
|
ManagedLinodeSettings::FIELD_ID, |
42
|
|
|
ManagedLinodeSettings::FIELD_LABEL, |
43
|
|
|
ManagedLinodeSettings::FIELD_GROUP, |
44
|
|
|
ManagedLinodeSettings::FIELD_SSH, |
45
|
|
|
]; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
protected function jsonToEntity(array $json): Entity |
49
|
|
|
{ |
50
|
|
|
return new ManagedLinodeSettings($this->client, $json); |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|