1: <?php
2: /**
3: * Copyright 2012-2014 Rackspace US, Inc.
4: *
5: * Licensed under the Apache License, Version 2.0 (the "License");
6: * you may not use this file except in compliance with the License.
7: * You may obtain a copy of the License at
8: *
9: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: namespace OpenCloud\Networking\Resource;
19:
20: use OpenCloud\Common\Resource\PersistentResource;
21:
22: /**
23: *
24: * Security group rules provide users the ability to specify the types of traffic that are allowed
25: * to pass through to and from ports (represented by {@see \OpenCloud\Networking\Resource\Port})
26: * on a virtual server instance.
27: *
28: * @see http://developer.openstack.org/api-ref-networking-v2.html#security_groups
29: *
30: * @package OpenCloud\Networking\Resource
31: */
32: class SecurityGroupRule extends PersistentResource
33: {
34: protected static $url_resource = 'security-group-rules';
35: protected static $json_name = 'security_group_rule';
36:
37: protected $id;
38: protected $direction;
39: protected $ethertype;
40: protected $portRangeMin;
41: protected $portRangeMax;
42: protected $protocol;
43: protected $remoteGroupId;
44: protected $remoteIpPrefix;
45: protected $securityGroupId;
46: protected $tenantId;
47: protected $links;
48:
49: protected $aliases = array(
50: 'port_range_min' => 'portRangeMin',
51: 'port_range_max' => 'portRangeMax',
52: 'remote_group_id' => 'remoteGroupId',
53: 'remote_ip_prefix' => 'remoteIpPrefix',
54: 'security_group_id' => 'securityGroupId',
55: 'tenant_id' => 'tenantId'
56: );
57:
58: protected $createKeys = array(
59: 'direction',
60: 'ethertype',
61: 'securityGroupId',
62: 'portRangeMin',
63: 'portRangeMax',
64: 'protocol',
65: 'remoteGroupId',
66: 'remoteIpPrefix'
67: );
68:
69: /**
70: * This method is inherited. The inherited method has protected scope
71: * but we are widening the scope to public so this method may be called
72: * from other classes such as {@see OpenCloud\Networking\Service}.
73: */
74: public function createJson()
75: {
76: return parent::createJson();
77: }
78:
79: /**
80: * {@inheritDoc}
81: */
82: public function update($params = array())
83: {
84: return $this->noUpdate();
85: }
86: }
87: