1
|
|
|
<?php declare (strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace OpenStack\Networking\v2\Extensions\SecurityGroups\Models; |
4
|
|
|
|
5
|
|
|
use OpenCloud\Common\Resource\OperatorResource; |
6
|
|
|
use OpenCloud\Common\Resource\Creatable; |
7
|
|
|
use OpenCloud\Common\Resource\Deletable; |
8
|
|
|
use OpenCloud\Common\Resource\Listable; |
9
|
|
|
use OpenCloud\Common\Resource\Retrievable; |
10
|
|
|
use OpenCloud\Common\Resource\Updateable; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Represents a SecurityGroup resource in the Network v2 service |
14
|
|
|
* |
15
|
|
|
* @property \OpenStack\Networking\v2\Extensions\SecurityGroups\Api $api |
16
|
|
|
*/ |
17
|
|
|
class SecurityGroup extends OperatorResource implements Creatable, Listable, Deletable, Retrievable, Updateable |
|
|
|
|
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
public $description; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var string |
26
|
|
|
*/ |
27
|
|
|
public $id; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var string |
31
|
|
|
*/ |
32
|
|
|
public $name; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var []SecurityGroupRule |
36
|
|
|
*/ |
37
|
|
|
public $securityGroupRules; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var string |
41
|
|
|
*/ |
42
|
|
|
public $tenantId; |
43
|
|
|
|
44
|
|
|
protected $aliases = [ |
45
|
|
|
'security_group_rules' => 'securityGroupRules', |
46
|
|
|
'rules' => 'securityGroupRules', |
47
|
|
|
'tenant_id' => 'tenantId', |
48
|
|
|
]; |
49
|
|
|
|
50
|
|
|
protected $resourceKey = 'security_group'; |
51
|
|
|
protected $resourcesKey = 'security_groups'; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* {@inheritDoc} |
55
|
|
|
*/ |
56
|
|
|
public function create(array $userOptions): Creatable |
57
|
|
|
{ |
58
|
|
|
$response = $this->execute($this->api->postSecurityGroups(), $userOptions); |
59
|
|
|
return $this->populateFromResponse($response); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* {@inheritDoc} |
64
|
|
|
*/ |
65
|
|
|
public function delete() |
66
|
|
|
{ |
67
|
|
|
$this->executeWithState($this->api->deleteSecurityGroup()); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* {@inheritDoc} |
72
|
|
|
*/ |
73
|
|
|
public function retrieve() |
74
|
|
|
{ |
75
|
|
|
$response = $this->executeWithState($this->api->getSecurityGroup()); |
76
|
|
|
$this->populateFromResponse($response); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
public function update() |
80
|
|
|
{ |
81
|
|
|
$response = $this->executeWithState($this->api->putSecurityGroups()); |
82
|
|
|
$this->populateFromResponse($response); |
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
|