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
37 self.name = kwargs.get('name')
38 self.domain_name = kwargs.get(
39 'domain', kwargs.get('domain', 'Default'))
41 self.description = kwargs.get('description')
42 if kwargs.get('enabled') is not None:
43 self.enabled = kwargs['enabled']
47 self.users = kwargs.get('users', list())
50 raise ProjectConfigError(
51 "The attribute name is required for ProjectConfig")
54 class ProjectConfigError(Exception):
56 Exception to be thrown when project settings attributes are incorrect