Merge "Remove Compass from genesis."
[genesis.git] / opensteak / tools / opensteak / foreman.py
1 #!/usr/bin/python3
2 # -*- coding: utf-8 -*-
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
4 # not use this file except in compliance with the License. You may obtain
5 # a copy of the License at
6 #
7 #      http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations
13 # under the License.
14 #
15 # Authors:
16 # @author: David Blaisonneau <david.blaisonneau@orange.com>
17 # @author: Arnaud Morin <arnaud1.morin@orange.com>
18
19 from opensteak.foreman_objects.api import Api
20 from opensteak.foreman_objects.objects import ForemanObjects
21 from opensteak.foreman_objects.domains import Domains
22 from opensteak.foreman_objects.smart_proxies import SmartProxies
23 from opensteak.foreman_objects.operatingsystems import OperatingSystems
24 from opensteak.foreman_objects.hostgroups import HostGroups
25 from opensteak.foreman_objects.hosts import Hosts
26 from opensteak.foreman_objects.architectures import Architectures
27 from opensteak.foreman_objects.subnets import Subnets
28 from opensteak.foreman_objects.puppetClasses import PuppetClasses
29 from opensteak.foreman_objects.compute_resources import ComputeResources
30
31
32 class OpenSteakForeman:
33     """
34     HostGroup class
35     """
36     def __init__(self, password, login='admin', ip='127.0.0.1'):
37         """ Function __init__
38         Init the API with the connection params
39         @param password: authentication password
40         @param password: authentication login - default is admin
41         @param ip: api ip - default is localhost
42         @return RETURN: self
43         """
44         self.api = Api(login=login, password=password, ip=ip,
45                        printErrors=False)
46         self.domains = Domains(self.api)
47         self.smartProxies = SmartProxies(self.api)
48         self.puppetClasses = PuppetClasses(self.api)
49         self.operatingSystems = OperatingSystems(self.api)
50         self.architectures = Architectures(self.api)
51         self.subnets = Subnets(self.api)
52         self.hostgroups = HostGroups(self.api)
53         self.hosts = Hosts(self.api)
54         self.computeResources = ComputeResources(self.api)
55         self.environments =  ForemanObjects(self.api,
56                                             'environments',
57                                             'environment')
58         self.smartClassParameters =  ForemanObjects(self.api,
59                                                    'smart_class_parameters',
60                                                    'smart_class_parameter')