      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\Identity\Resource;
     19:
     20: use OpenCloud\Common\PersistentObject;
     21:
     22: /**
     23:  * Tenant class for tenant functionality.
     24:  *
     25:  * A tenant is a container used to group or isolate resources and/or identity objects. Depending on the service
     26:  * operator, a tenant may map to a customer, account, organization, or project.
     27:  *
     28:  * @package OpenCloud\Identity\Resource
     29:  */
     30: class Tenant extends PersistentObject
     31: {
     32:     /** @var int The tenant ID */
     33:     private $id;
     34:
     35:     /** @var string The tenant name */
     36:     private $name;
     37:
     38:     /** @var string A description of the tenant */
     39:     private $description;
     40:
     41:     /** @var bool Whether this tenant is enabled or not (i.e. whether it can fulfil API operations) */
     42:     private $enabled;
     43:
     44:     protected static $url_resource = 'tenants';
     45:     protected static $json_name = 'tenants';
     46:
     47:     /**
     48:      * @param $id Sets the ID
     49:      */
     50:     public function setId($id)
     51:     {
     52:         $this->id = $id;
     53:     }
     54:
     55:     /**
     56:      * @return string Returns the ID
     57:      */
     58:     public function getId()
     59:     {
     60:         return $this->id;
     61:     }
     62:
     63:     /**
     64:      * @param $name Sets the name
     65:      */
     66:     public function setName($name)
     67:     {
     68:         $this->name = $name;
     69:     }
     70:
     71:     /**
     72:      * @return string Returns the name
     73:      */
     74:     public function getName()
     75:     {
     76:         return $this->name;
     77:     }
     78:
     79:     /**
     80:      * @param $description Sets the description
     81:      */
     82:     public function setDescription($description)
     83:     {
     84:         $this->description = $description;
     85:     }
     86:
     87:     /**
     88:      * @return string Returns the description
     89:      */
     90:     public function getDescription()
     91:     {
     92:         return $this->description;
     93:     }
     94:
     95:     /**
     96:      * @param $enabled Enables/disables the tenant
     97:      */
     98:     public function setEnabled($enabled)
     99:     {
    100:         $this->enabled = $enabled;
    101:     }
    102:
    103:     /**
    104:      * @return bool Checks whether this tenant is enabled or not
    105:      */
    106:     public function isEnabled()
    107:     {
    108:         return $this->enabled === true;
    109:     }
    110: }
    111: