|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
namespace OpenStack\Networking\v2\Extensions\SecurityGroups\Models; |
|
4
|
|
|
|
|
5
|
|
|
use OpenStack\Common\Resource\OperatorResource; |
|
6
|
|
|
use OpenStack\Common\Resource\Creatable; |
|
7
|
|
|
use OpenStack\Common\Resource\Deletable; |
|
8
|
|
|
use OpenStack\Common\Resource\Listable; |
|
9
|
|
|
use OpenStack\Common\Resource\Retrievable; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Represents a SecurityGroupRule resource in the Network v2 service |
|
13
|
|
|
* |
|
14
|
|
|
* @property \OpenStack\Networking\v2\Extensions\SecurityGroups\Api $api |
|
15
|
|
|
*/ |
|
16
|
|
|
class SecurityGroupRule extends OperatorResource implements Creatable, Listable, Deletable, Retrievable |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* @var string |
|
20
|
|
|
*/ |
|
21
|
|
|
public $direction; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @var string |
|
25
|
|
|
*/ |
|
26
|
|
|
public $ethertype; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @var string |
|
30
|
|
|
*/ |
|
31
|
|
|
public $id; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @var integer |
|
35
|
|
|
*/ |
|
36
|
|
|
public $portRangeMax; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @var integer |
|
40
|
|
|
*/ |
|
41
|
|
|
public $portRangeMin; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var string |
|
45
|
|
|
*/ |
|
46
|
|
|
public $protocol; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @var string |
|
50
|
|
|
*/ |
|
51
|
|
|
public $remoteGroupId; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* @var string |
|
55
|
|
|
*/ |
|
56
|
|
|
public $remoteIpPrefix; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @var string |
|
60
|
|
|
*/ |
|
61
|
|
|
public $securityGroupId; |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @var string |
|
65
|
|
|
*/ |
|
66
|
|
|
public $tenantId; |
|
67
|
|
|
|
|
68
|
|
|
protected $aliases = [ |
|
69
|
|
|
'port_range_max' => 'portRangeMax', |
|
70
|
|
|
'port_range_min' => 'portRangeMin', |
|
71
|
|
|
'remote_group_id' => 'remoteGroupId', |
|
72
|
|
|
'remote_ip_prefix' => 'remoteIpPrefix', |
|
73
|
|
|
'security_group_id' => 'securityGroupId', |
|
74
|
|
|
'tenant_id' => 'tenantId', |
|
75
|
|
|
]; |
|
76
|
|
|
|
|
77
|
|
|
protected $resourceKey = 'security_group_rule'; |
|
78
|
|
|
|
|
79
|
|
|
protected $resourcesKey = 'security_group_rules'; |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* {@inheritDoc} |
|
83
|
|
|
*/ |
|
84
|
|
|
public function create(array $userOptions): Creatable |
|
85
|
|
|
{ |
|
86
|
|
|
$response = $this->execute($this->api->postSecurityRules(), $userOptions); |
|
87
|
|
|
return $this->populateFromResponse($response); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* {@inheritDoc} |
|
92
|
|
|
*/ |
|
93
|
|
|
public function delete() |
|
94
|
|
|
{ |
|
95
|
|
|
$this->executeWithState($this->api->deleteSecurityRule()); |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* {@inheritDoc} |
|
100
|
|
|
*/ |
|
101
|
|
|
public function retrieve() |
|
102
|
|
|
{ |
|
103
|
|
|
$response = $this->executeWithState($this->api->getSecurityRule()); |
|
104
|
|
|
$this->populateFromResponse($response); |
|
105
|
|
|
} |
|
106
|
|
|
} |
|
107
|
|
|
|