1 # Copyright (c) 2018 Amdocs
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at:
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 from multicloud_azure.pub.vim.vimsdk.azure_credentials import ClientObj
16 from azure.mgmt.compute import ComputeManagementClient
17 from azure.mgmt.resource import ResourceManagementClient
19 LOG = logging.getLogger(__name__)
22 class baseclient(object):
24 def __init__(self, **kwargs):
28 def get_compute_client(self, params):
29 if self._compute is not None:
31 credentials = ClientObj().get_client_obj(params)
32 self._compute = ComputeManagementClient(
33 credentials, params['subscription_id'])
36 def get_resource_client(self, params):
37 if self._resource is not None:
39 credentials = ClientObj.get_client_obj(params)
40 self._resource = ResourceManagementClient(
41 credentials, params['subscription_id'])