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: * A security group is a named container for security group rules, each of which is
24: * represented by {@see \OpenCloud\Networking\Resource\SecurityGroupRule}.
25: *
26: * @see http://developer.openstack.org/api-ref-networking-v2.html#security_groups
27: *
28: * @package OpenCloud\Networking\Resource
29: */
30: class SecurityGroup extends PersistentResource
31: {
32: protected static $url_resource = 'security-groups';
33: protected static $json_name = 'security_group';
34:
35: protected $id;
36: protected $name;
37: protected $description;
38: protected $securityGroupRules;
39: protected $tenantId;
40: protected $links;
41:
42: protected $aliases = array(
43: 'security_group_rules' => 'securityGroupRules',
44: 'tenant_id' => 'tenantId'
45: );
46:
47: protected $createKeys = array(
48: 'name',
49: 'description'
50: );
51:
52: /**
53: * This method is inherited. The inherited method has protected scope
54: * but we are widening the scope to public so this method may be called
55: * from other classes such as {@see OpenCloud\Networking\Service}.
56: */
57: public function createJson()
58: {
59: return parent::createJson();
60: }
61:
62: /**
63: * {@inheritDoc}
64: */
65: public function update($params = array())
66: {
67: return $this->noUpdate();
68: }
69: }
70: