|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +### |
| 3 | +# (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP |
| 4 | +# |
| 5 | +# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 6 | +# of this software and associated documentation files (the "Software"), to deal |
| 7 | +# in the Software without restriction, including without limitation the rights |
| 8 | +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 9 | +# copies of the Software, and to permit persons to whom the Software is |
| 10 | +# furnished to do so, subject to the following conditions: |
| 11 | +# |
| 12 | +# The above copyright notice and this permission notice shall be included in |
| 13 | +# all copies or substantial portions of the Software. |
| 14 | +# |
| 15 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 18 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 | +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 21 | +# THE SOFTWARE. |
| 22 | +### |
| 23 | + |
| 24 | +from __future__ import absolute_import |
| 25 | +from __future__ import division |
| 26 | +from __future__ import print_function |
| 27 | +from __future__ import unicode_literals |
| 28 | + |
| 29 | +from future import standard_library |
| 30 | + |
| 31 | +standard_library.install_aliases() |
| 32 | + |
| 33 | +from hpOneView.resources.resource import ResourceClient |
| 34 | + |
| 35 | + |
| 36 | +class Versions(object): |
| 37 | + """ |
| 38 | + Version API client. It indicates the range of API versions supported by the appliance. |
| 39 | +
|
| 40 | + """ |
| 41 | + URI = '/rest/version' |
| 42 | + |
| 43 | + def __init__(self, con): |
| 44 | + self._client = ResourceClient(con, self.URI) |
| 45 | + |
| 46 | + def get_version(self): |
| 47 | + """ |
| 48 | + Returns the range of possible API versions supported by the appliance. |
| 49 | + The response contains the current version and the minimum version. |
| 50 | + The current version is the recommended version to specify in the REST header. |
| 51 | + The other versions are supported for backward compatibility, but might not support the most current features. |
| 52 | +
|
| 53 | + Returns: |
| 54 | + dict: The minimum and maximum supported API versions. |
| 55 | + """ |
| 56 | + version = self._client.get(self.URI) |
| 57 | + return version |
0 commit comments