1 # Copyright (c) 2017 Cable Television Laboratories, Inc. ("CableLabs")
2 # and others. All rights reserved.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
17 class ProjectConfig(object):
19 Class to hold the configuration settings required for creating OpenStack
23 def __init__(self, **kwargs):
27 :param name: the project's name (required)
28 :param domain or domain_name: the project's domain name
29 (default = 'Default').
30 Field is used for v3 clients
31 :param description: the description (optional)
32 :param users: list of users to associate project to (optional)
33 :param enabled: denotes whether or not the project is enabled
35 :param quotas: quota values to override (optional)
38 self.name = kwargs.get('name')
39 self.domain_name = kwargs.get(
40 'domain_name', kwargs.get('domain', 'Default'))
42 self.description = kwargs.get('description')
43 if kwargs.get('enabled') is not None:
44 self.enabled = kwargs['enabled']
48 self.users = kwargs.get('users', list())
50 self.quotas = kwargs.get('quotas')
53 raise ProjectConfigError(
54 "The attribute name is required for ProjectConfig")
57 class ProjectConfigError(Exception):
59 Exception to be thrown when project settings attributes are incorrect