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 network is an isolated virtual layer-2 broadcast domain that is typically
24: * reserved for the tenant who created it unless you configure the network to be
25: * shared. The network is the main entity in the Networking service. Ports ({@see
26: * \OpenCloud\Networking\Resource\Port}) and subnets ({@see
27: * \OpenCloud\Networking\Resource\Subnet}) are always associated with a network.
28: *
29: * @see http://docs.openstack.org/api/openstack-network/2.0/content/Overview-d1e71.html#Network
30: *
31: * @package OpenCloud\Networking\Resource
32: */
33: class Network extends PersistentResource implements NetworkInterface
34: {
35: protected static $url_resource = 'networks';
36: protected static $json_name = 'network';
37:
38: protected $id;
39: protected $adminStateUp;
40: protected $name;
41: protected $shared;
42: protected $status;
43: protected $subnets;
44: protected $tenantId;
45: protected $links;
46:
47: protected $aliases = array(
48: 'admin_state_up' => 'adminStateUp',
49: 'tenant_id' => 'tenantId'
50: );
51:
52: protected $createKeys = array(
53: 'adminStateUp',
54: 'name',
55: 'shared',
56: 'tenantId'
57: );
58:
59: protected $updateKeys = array(
60: 'name'
61: );
62:
63: /**
64: * This method is inherited. The inherited method has protected scope
65: * but we are widening the scope to public so this method may be called
66: * from other classes such as {@see OpenCloud\Networking\Service}.
67: */
68: public function createJson()
69: {
70: return parent::createJson();
71: }
72:
73: public function getId()
74: {
75: return $this->id;
76: }
77: }
78: