Overview

Namespaces

  • PHP
  • Saklient
    • Cloud
      • Enums
      • Errors
      • Models
      • Resources
    • Errors

Classes

  • Activity
  • Appliance
  • Archive
  • Bridge
  • Disk
  • DiskActivity
  • DiskConfig
  • DiskPlan
  • FtpInfo
  • Icon
  • Iface
  • IfaceActivity
  • Ipv4Net
  • Ipv4Range
  • Ipv6Net
  • IsoImage
  • LbServer
  • LbVirtualIp
  • License
  • LicenseInfo
  • LoadBalancer
  • Region
  • Router
  • RouterActivity
  • RouterPlan
  • Script
  • Server
  • ServerActivity
  • ServerInstance
  • ServerPlan
  • Swytch
  • VpcRouter
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: namespace Saklient\Cloud\Resources;
  4: 
  5: require_once __DIR__ . "/../../../Saklient/Util.php";
  6: use \Saklient\Util;
  7: require_once __DIR__ . "/../../../Saklient/Errors/SaklientException.php";
  8: use \Saklient\Errors\SaklientException;
  9: 
 10: /**
 11:  * ロードバランサの監視対象サーバ設定。
 12:  * 
 13:  * @property boolean $enabled 有効状態 
 14:  * @property string $ipAddress IPアドレス 
 15:  * @property int $port ポート番号 
 16:  * @property string $protocol 監視方法 
 17:  * @property string $pathToCheck 監視対象パス 
 18:  * @property int $responseExpected 監視時に期待されるレスポンスコード 
 19:  * @property-read int $activeConnections 現在の接続数 
 20:  * @property-read string $status 現在の状態 
 21:  */
 22: class LbServer {
 23:     
 24:     /**
 25:      * @private
 26:      * @access protected
 27:      * @ignore
 28:      * @var boolean
 29:      */
 30:     protected $_enabled;
 31:     
 32:     /**
 33:      * @access public
 34:      * @ignore
 35:      * @return boolean
 36:      */
 37:     public function get_enabled()
 38:     {
 39:         return $this->_enabled;
 40:     }
 41:     
 42:     /**
 43:      * @access public
 44:      * @ignore
 45:      * @param boolean|null $v
 46:      * @return boolean
 47:      */
 48:     public function set_enabled($v)
 49:     {
 50:         Util::validateArgCount(func_num_args(), 1);
 51:         Util::validateType($v, "boolean");
 52:         $this->_enabled = $v;
 53:         return $this->_enabled;
 54:     }
 55:     
 56:     
 57:     
 58:     /**
 59:      * @private
 60:      * @access protected
 61:      * @ignore
 62:      * @var string
 63:      */
 64:     protected $_ipAddress;
 65:     
 66:     /**
 67:      * @access public
 68:      * @ignore
 69:      * @return string
 70:      */
 71:     public function get_ipAddress()
 72:     {
 73:         return $this->_ipAddress;
 74:     }
 75:     
 76:     /**
 77:      * @access public
 78:      * @ignore
 79:      * @param string $v
 80:      * @return string
 81:      */
 82:     public function set_ipAddress($v)
 83:     {
 84:         Util::validateArgCount(func_num_args(), 1);
 85:         Util::validateType($v, "string");
 86:         $this->_ipAddress = $v;
 87:         return $this->_ipAddress;
 88:     }
 89:     
 90:     
 91:     
 92:     /**
 93:      * @private
 94:      * @access protected
 95:      * @ignore
 96:      * @var int
 97:      */
 98:     protected $_port;
 99:     
100:     /**
101:      * @access public
102:      * @ignore
103:      * @return int
104:      */
105:     public function get_port()
106:     {
107:         return $this->_port;
108:     }
109:     
110:     /**
111:      * @access public
112:      * @ignore
113:      * @param int|null $v
114:      * @return int
115:      */
116:     public function set_port($v)
117:     {
118:         Util::validateArgCount(func_num_args(), 1);
119:         Util::validateType($v, "int");
120:         $this->_port = $v;
121:         return $this->_port;
122:     }
123:     
124:     
125:     
126:     /**
127:      * @private
128:      * @access protected
129:      * @ignore
130:      * @var string
131:      */
132:     protected $_protocol;
133:     
134:     /**
135:      * @access public
136:      * @ignore
137:      * @return string
138:      */
139:     public function get_protocol()
140:     {
141:         return $this->_protocol;
142:     }
143:     
144:     /**
145:      * @access public
146:      * @ignore
147:      * @param string $v
148:      * @return string
149:      */
150:     public function set_protocol($v)
151:     {
152:         Util::validateArgCount(func_num_args(), 1);
153:         Util::validateType($v, "string");
154:         $this->_protocol = $v;
155:         return $this->_protocol;
156:     }
157:     
158:     
159:     
160:     /**
161:      * @private
162:      * @access protected
163:      * @ignore
164:      * @var string
165:      */
166:     protected $_pathToCheck;
167:     
168:     /**
169:      * @access public
170:      * @ignore
171:      * @return string
172:      */
173:     public function get_pathToCheck()
174:     {
175:         return $this->_pathToCheck;
176:     }
177:     
178:     /**
179:      * @access public
180:      * @ignore
181:      * @param string $v
182:      * @return string
183:      */
184:     public function set_pathToCheck($v)
185:     {
186:         Util::validateArgCount(func_num_args(), 1);
187:         Util::validateType($v, "string");
188:         $this->_pathToCheck = $v;
189:         return $this->_pathToCheck;
190:     }
191:     
192:     
193:     
194:     /**
195:      * @private
196:      * @access protected
197:      * @ignore
198:      * @var int
199:      */
200:     protected $_responseExpected;
201:     
202:     /**
203:      * @access public
204:      * @ignore
205:      * @return int
206:      */
207:     public function get_responseExpected()
208:     {
209:         return $this->_responseExpected;
210:     }
211:     
212:     /**
213:      * @access public
214:      * @ignore
215:      * @param int|null $v
216:      * @return int
217:      */
218:     public function set_responseExpected($v)
219:     {
220:         Util::validateArgCount(func_num_args(), 1);
221:         Util::validateType($v, "int");
222:         $this->_responseExpected = $v;
223:         return $this->_responseExpected;
224:     }
225:     
226:     
227:     
228:     /**
229:      * @private
230:      * @access protected
231:      * @ignore
232:      * @var int
233:      */
234:     protected $_activeConnections;
235:     
236:     /**
237:      * @access public
238:      * @ignore
239:      * @return int
240:      */
241:     public function get_activeConnections()
242:     {
243:         return $this->_activeConnections;
244:     }
245:     
246:     
247:     
248:     /**
249:      * @private
250:      * @access protected
251:      * @ignore
252:      * @var string
253:      */
254:     protected $_status;
255:     
256:     /**
257:      * @access public
258:      * @ignore
259:      * @return string
260:      */
261:     public function get_status()
262:     {
263:         return $this->_status;
264:     }
265:     
266:     
267:     
268:     /**
269:      * @ignore
270:      * @access public
271:      * @param mixed $obj=null
272:      */
273:     public function __construct($obj=null)
274:     {
275:         if ($obj == null) {
276:             $obj = (object)[];
277:         }
278:         $health = Util::getByPathAny(new \ArrayObject([$obj]), new \ArrayObject([
279:             "HealthCheck",
280:             "healthCheck",
281:             "health_check",
282:             "health"
283:         ]));
284:         $enabled = Util::getByPathAny(new \ArrayObject([$obj]), new \ArrayObject(["Enabled", "enabled"]));
285:         $this->_enabled = null;
286:         if ($enabled != null) {
287:             $enabledStr = $enabled;
288:             $this->_enabled = strtolower($enabledStr) == "true";
289:         }
290:         $this->_ipAddress = Util::getByPathAny(new \ArrayObject([$obj]), new \ArrayObject([
291:             "IPAddress",
292:             "ipAddress",
293:             "ip_address",
294:             "ip"
295:         ]));
296:         $this->_protocol = Util::getByPathAny(new \ArrayObject([$health, $obj]), new \ArrayObject(["Protocol", "protocol"]));
297:         $this->_pathToCheck = Util::getByPathAny(new \ArrayObject([$health, $obj]), new \ArrayObject([
298:             "Path",
299:             "path",
300:             "pathToCheck",
301:             "path_to_check"
302:         ]));
303:         $port = Util::getByPathAny(new \ArrayObject([$obj]), new \ArrayObject(["Port", "port"]));
304:         $this->_port = null;
305:         if ($port != null) {
306:             $this->_port = intval($port);
307:         }
308:         if ($this->_port == 0) {
309:             $this->_port = null;
310:         }
311:         $responseExpected = Util::getByPathAny(new \ArrayObject([$health, $obj]), new \ArrayObject([
312:             "Status",
313:             "status",
314:             "responseExpected",
315:             "response_expected"
316:         ]));
317:         $this->_responseExpected = null;
318:         if ($responseExpected != null) {
319:             $this->_responseExpected = intval($responseExpected);
320:         }
321:         if ($this->_responseExpected == 0) {
322:             $this->_responseExpected = null;
323:         }
324:         $this->_activeConnections = 0;
325:         $this->_status = null;
326:     }
327:     
328:     /**
329:      * @access public
330:      * @return mixed
331:      */
332:     public function toRawSettings()
333:     {
334:         return (object)[
335:             'Enabled' => $this->_enabled == null ? null : ($this->_enabled ? "True" : "False"),
336:             'IPAddress' => $this->_ipAddress,
337:             'Port' => $this->_port,
338:             'HealthCheck' => (object)[
339:                 'Protocol' => $this->_protocol,
340:                 'Path' => $this->_pathToCheck,
341:                 'Status' => $this->_responseExpected
342:             ]
343:         ];
344:     }
345:     
346:     /**
347:      * @ignore
348:      * @access public
349:      * @param mixed $obj
350:      * @return \Saklient\Cloud\Resources\LbServer
351:      */
352:     public function updateStatus($obj)
353:     {
354:         Util::validateArgCount(func_num_args(), 1);
355:         $connStr = $obj->{"ActiveConn"};
356:         $this->_activeConnections = 0;
357:         if ($connStr != null) {
358:             $this->_activeConnections = intval($connStr);
359:         }
360:         $status = $obj->{"Status"};
361:         $this->_status = $status == null ? null : strtolower($status);
362:         return $this;
363:     }
364:     
365:     /**
366:      * @ignore
367:      */
368:     public function __get($key) {
369:         switch ($key) {
370:             case "enabled": return $this->get_enabled();
371:             case "ipAddress": return $this->get_ipAddress();
372:             case "port": return $this->get_port();
373:             case "protocol": return $this->get_protocol();
374:             case "pathToCheck": return $this->get_pathToCheck();
375:             case "responseExpected": return $this->get_responseExpected();
376:             case "activeConnections": return $this->get_activeConnections();
377:             case "status": return $this->get_status();
378:             default: return null;
379:         }
380:     }
381:     
382:     /**
383:      * @ignore
384:      */
385:     public function __set($key, $v) {
386:         switch ($key) {
387:             case "enabled": return $this->set_enabled($v);
388:             case "ipAddress": return $this->set_ipAddress($v);
389:             case "port": return $this->set_port($v);
390:             case "protocol": return $this->set_protocol($v);
391:             case "pathToCheck": return $this->set_pathToCheck($v);
392:             case "responseExpected": return $this->set_responseExpected($v);
393:             default: throw new SaklientException('non_writable_field', 'Non-writable field: Saklient\\Cloud\\Resources\\LbServer#'.$key);
394:         }
395:     }
396: 
397: }
398: 
399: 
API documentation generated by ApiGen 2.8.0