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\StackScripts; |
13
|
|
|
|
14
|
|
|
use Linode\Entity; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* A StackScript enables you to quickly deploy a fully-configured application in an |
18
|
|
|
* automated manner. |
19
|
|
|
* |
20
|
|
|
* @property int $id The unique ID of this StackScript. |
21
|
|
|
* @property string $username The User who created the StackScript. |
22
|
|
|
* @property string $label The StackScript's label is for display purposes only. |
23
|
|
|
* @property string[] $images An array of Image IDs. These are the images that can be deployed with this |
24
|
|
|
* Stackscript. |
25
|
|
|
* @property bool $is_public This determines whether other users can use your StackScript. **Once a StackScript |
26
|
|
|
* is made public, it cannot be made private.** |
27
|
|
|
* @property string $created The date this StackScript was created. |
28
|
|
|
* @property string $updated The date this StackScript was last updated. |
29
|
|
|
* @property string $user_gravatar_id The Gravatar ID for the User who created the StackScript. |
30
|
|
|
* @property string $description A description for the StackScript. |
31
|
|
|
* @property int $deployments_total The total number of times this StackScript has been deployed. |
32
|
|
|
* @property int $deployments_active Count of currently active, deployed Linodes created from this StackScript. |
33
|
|
|
* @property string $rev_note This field allows you to add notes for the set of revisions made to this |
34
|
|
|
* StackScript. |
35
|
|
|
* @property string $script The script to execute when provisioning a new Linode with this StackScript. |
36
|
|
|
* @property UserDefinedField[] $user_defined_fields This is a list of fields defined with a special syntax inside this StackScript |
37
|
|
|
* that allow for supplying customized parameters during deployment. See Variables |
38
|
|
|
* and UDFs for more information. |
39
|
|
|
*/ |
40
|
|
|
class StackScript extends Entity |
41
|
|
|
{ |
42
|
|
|
// Available fields. |
43
|
|
|
public const FIELD_ID = 'id'; |
44
|
|
|
public const FIELD_USERNAME = 'username'; |
45
|
|
|
public const FIELD_LABEL = 'label'; |
46
|
|
|
public const FIELD_IMAGES = 'images'; |
47
|
|
|
public const FIELD_IS_PUBLIC = 'is_public'; |
48
|
|
|
public const FIELD_CREATED = 'created'; |
49
|
|
|
public const FIELD_UPDATED = 'updated'; |
50
|
|
|
public const FIELD_USER_GRAVATAR_ID = 'user_gravatar_id'; |
51
|
|
|
public const FIELD_DESCRIPTION = 'description'; |
52
|
|
|
public const FIELD_DEPLOYMENTS_TOTAL = 'deployments_total'; |
53
|
|
|
public const FIELD_DEPLOYMENTS_ACTIVE = 'deployments_active'; |
54
|
|
|
public const FIELD_REV_NOTE = 'rev_note'; |
55
|
|
|
public const FIELD_SCRIPT = 'script'; |
56
|
|
|
public const FIELD_USER_DEFINED_FIELDS = 'user_defined_fields'; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @codeCoverageIgnore This method was autogenerated. |
60
|
|
|
*/ |
61
|
|
|
public function __get(string $name): mixed |
62
|
|
|
{ |
63
|
|
|
return match ($name) { |
64
|
|
|
self::FIELD_USER_DEFINED_FIELDS => array_map(fn ($data) => new UserDefinedField($this->client, $data), $this->data[$name]), |
65
|
|
|
default => parent::__get($name), |
66
|
|
|
}; |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|