Skip to content

Commit dea9c30

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Use v2 API by default"
2 parents 5bd8a2f + 2d965f9 commit dea9c30

3 files changed

Lines changed: 23 additions & 15 deletions

File tree

cloudkittyclient/osc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from osc_lib import utils
1616

17-
DEFAULT_API_VERSION = '1'
17+
DEFAULT_API_VERSION = '2'
1818
API_VERSION_OPTION = 'os_rating_api_version'
1919
API_NAME = "rating"
2020
API_VERSIONS = {

doc/source/usage.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ Version
4242
-------
4343

4444
Two versions of the client exist: v1 and v2. The v2 version adds support for
45-
v2 API endpoints. The default API version is 1. You can specify which API
45+
v2 API endpoints. The default API version is 2. You can specify which API
4646
version you want to use via a CLI option:
4747

4848
.. code-block:: shell
4949
5050
# EITHER
51-
cloudkitty --os-rating-api-version 2 summary get
51+
cloudkitty --os-rating-api-version 1 module list
5252
5353
# OR
54-
export OS_RATING_API_VERSION=2
55-
cloudkitty summary get
54+
export OS_RATING_API_VERSION=1
55+
cloudkitty module list
5656
5757
Again, the option can also be provided to the OSC plugin, both via the CLI
5858
flag or the environment variable.
@@ -68,7 +68,7 @@ to use it without keystone authentication, cloudkittyclient provides the
6868
>>> from cloudkittyclient import auth as ck_auth
6969

7070
>>> auth = ck_auth.CloudKittyNoAuthPlugin(endpoint='http://127.0.0.1:8889')
71-
>>> client = ck_client.Client('1', auth=auth)
71+
>>> client = ck_client.Client('2', auth=auth)
7272
>>> client.report.get_summary()
7373
{u'summary': [{u'begin': u'2018-03-01T00:00:00',
7474
u'end': u'2018-04-01T00:00:00',
@@ -95,7 +95,7 @@ Else, use it the same way as any other OpenStack client::
9595

9696
>>> ck_session = session.Session(auth=auth)
9797

98-
>>> c = ck_client.Client('1', session=ck_session)
98+
>>> c = ck_client.Client('2', session=ck_session)
9999

100100
>>> c.report.get_summary()
101101
{u'summary': [{u'begin': u'2018-03-01T00:00:00',
@@ -112,25 +112,25 @@ Else, use it the same way as any other OpenStack client::
112112
and ``cacert``::
113113

114114
>>> client = ck_client.Client(
115-
'1', auth=auth, insecure=False, cacert='/path/to/ca')
115+
'2', auth=auth, insecure=False, cacert='/path/to/ca')
116116

117117

118-
If you want to use the v2 API, you have to specify it at client instanciation
118+
If you want to use the v1 API, you have to specify it at client instanciation
119119

120120
.. code-block:: python
121121
122-
c = ck_client.Client('2', session=session)
122+
c = ck_client.Client('1', session=session)
123123
124124
When using the ``cloudkitty`` CLI client with keystone authentication, the
125125
auth plugin to use should automagically be detected. If not, you can specify
126126
the auth plugin to use with ``--os-auth-type/--os-auth-plugin``::
127127

128128
$ cloudkitty --debug --os-auth-type cloudkitty-noauth summary get
129-
+------------+---------------+------------+---------------------+---------------------+
130-
| Project ID | Resource Type | Rate | Begin Time | End Time |
131-
+------------+---------------+------------+---------------------+---------------------+
132-
| ALL | ALL | 1676.95499 | 2018-03-01T00:00:00 | 2018-04-01T00:00:00 |
133-
+------------+---------------+------------+---------------------+---------------------+
129+
+---------------------------+---------------------------+------------+-------------------+
130+
| Begin | End | Qty | Rate |
131+
+---------------------------+---------------------------+------------+-------------------+
132+
| 2025-12-01T00:00:00+01:00 | 2026-01-01T00:00:00+01:00 | 21662194.0 | 3618130.211340219 |
133+
+---------------------------+---------------------------+------------+-------------------+
134134

135135

136136
CSV report generation
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
upgrade:
3+
- |
4+
The default API version has been changed from v1 to v2. Users who want
5+
to continue using the v1 API must now explicitly specify the API version
6+
using the ``--os-rating-api-version 1`` CLI option or by setting the
7+
``OS_RATING_API_VERSION=1`` environment variable. If no version is
8+
specified, the client will now use the v2 API by default.

0 commit comments

Comments
 (0)