Browse Source

Add the link between the client and panels

Change-Id: I0efa7b9b91a2c0d97f1506a74d5b0c16bbb6c277
changes/40/121340/1
François Magimel 7 years ago
parent
commit
797a89586b
  1. 0
      cloudkittydashboard/api/__init__.py
  2. 48
      cloudkittydashboard/api/cloudkitty.py

0
cloudkittydashboard/api/__init__.py

48
cloudkittydashboard/api/cloudkitty.py

@ -0,0 +1,48 @@
# -*- coding: utf-8 -*-
# Copyright 2014 Objectif Libre
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# @author: François Magimel (linkid)
"""
The API for the CloudKitty Horizon plugin.
"""
import logging
from cloudkittyclient import client as cloudkitty_client
from openstack_dashboard.api import base
LOG = logging.getLogger(__name__)
def cloudkittyclient(request):
"""Initialization of CloudKitty client."""
username = request.user.username
token = request.user.token.id
tenant_name = request.user.tenant_id
endpoint = base.url_for(request, 'billing')
auth_url = base.url_for(request, 'identity')
LOG.debug('cloudkittyclient connection created using token "%s" '
'and endpoint "%s"' % (request.user.token.id, endpoint))
return cloudkitty_client.Client('1',
username=username,
token=token,
tenant_name=tenant_name,
auth_url=auth_url,
endpoint=endpoint)
Loading…
Cancel
Save