1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace OpenStack\Networking\v2\Models; |
4
|
|
|
|
5
|
|
|
use OpenStack\Common\Resource\Creatable; |
6
|
|
|
use OpenStack\Common\Resource\Deletable; |
7
|
|
|
use OpenStack\Common\Resource\OperatorResource; |
8
|
|
|
use OpenStack\Common\Resource\Retrievable; |
9
|
|
|
use OpenStack\Common\Resource\Updateable; |
10
|
|
|
use OpenStack\Networking\v2\Api; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Represents a Neutron v2 LoadBalancer Health Monitor |
14
|
|
|
* |
15
|
|
|
* @property Api $api |
16
|
|
|
*/ |
17
|
|
View Code Duplication |
class LoadBalancerHealthMonitor extends OperatorResource implements Creatable, Retrievable, Updateable, Deletable |
|
|
|
|
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
public $id; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var string |
26
|
|
|
*/ |
27
|
|
|
public $tenantId; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var string |
31
|
|
|
*/ |
32
|
|
|
public $type; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var integer |
36
|
|
|
*/ |
37
|
|
|
public $delay; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var integer |
41
|
|
|
*/ |
42
|
|
|
public $timeout; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var integer |
46
|
|
|
*/ |
47
|
|
|
public $maxRetries; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @var string |
51
|
|
|
*/ |
52
|
|
|
public $httpMethod; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @var string |
56
|
|
|
*/ |
57
|
|
|
public $urlPath; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @var string |
61
|
|
|
*/ |
62
|
|
|
public $expectedCodes; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @var boolean |
66
|
|
|
*/ |
67
|
|
|
public $adminStateUp; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @var string |
71
|
|
|
*/ |
72
|
|
|
public $poolId; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @var LoadBalancerPool[] |
76
|
|
|
*/ |
77
|
|
|
public $pools; |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @var string |
81
|
|
|
*/ |
82
|
|
|
public $operatingStatus; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @var string |
86
|
|
|
*/ |
87
|
|
|
public $provisioningStatus; |
88
|
|
|
|
89
|
|
|
protected $resourcesKey = 'healthmonitors'; |
90
|
|
|
protected $resourceKey = 'healthmonitor'; |
91
|
|
|
|
92
|
|
|
protected $aliases = [ |
93
|
|
|
'tenant_id' => 'tenantId', |
94
|
|
|
'admin_state_up' => 'adminStateUp', |
95
|
|
|
'max_retries' => 'maxRetries', |
96
|
|
|
'http_method' => 'httpMethod', |
97
|
|
|
'url_path' => 'urlPath', |
98
|
|
|
'expected_codes' => 'expectedCodes', |
99
|
|
|
'pool_id' => 'poolId', |
100
|
|
|
'operating_status' => 'operatingStatus', |
101
|
|
|
'provisioning_status' => 'provisioningStatus' |
102
|
|
|
]; |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* {@inheritDoc} |
106
|
|
|
*/ |
107
|
|
|
public function create(array $userOptions): Creatable |
108
|
|
|
{ |
109
|
|
|
$response = $this->execute($this->api->postLoadBalancerHealthMonitor(), $userOptions); |
110
|
|
|
return $this->populateFromResponse($response); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* {@inheritDoc} |
115
|
|
|
*/ |
116
|
|
|
public function retrieve() |
117
|
|
|
{ |
118
|
|
|
$response = $this->execute($this->api->getLoadBalancerHealthMonitor(), ['id' => (string)$this->id]); |
119
|
|
|
$this->populateFromResponse($response); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* {@inheritDoc} |
124
|
|
|
*/ |
125
|
|
|
public function update() |
126
|
|
|
{ |
127
|
|
|
$response = $this->executeWithState($this->api->putLoadBalancerHealthMonitor()); |
128
|
|
|
$this->populateFromResponse($response); |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* {@inheritDoc} |
133
|
|
|
*/ |
134
|
|
|
public function delete() |
135
|
|
|
{ |
136
|
|
|
$this->executeWithState($this->api->deleteLoadBalancerHealthMonitor()); |
137
|
|
|
} |
138
|
|
|
} |
139
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.