aodhclient-1.0.0/0000775000175100017510000000000013234417066013654 5ustar zuulzuul00000000000000aodhclient-1.0.0/releasenotes/0000775000175100017510000000000013234417066016345 5ustar zuulzuul00000000000000aodhclient-1.0.0/releasenotes/source/0000775000175100017510000000000013234417066017645 5ustar zuulzuul00000000000000aodhclient-1.0.0/releasenotes/source/_static/0000775000175100017510000000000013234417066021273 5ustar zuulzuul00000000000000aodhclient-1.0.0/releasenotes/source/_static/.placeholder0000666000175100017510000000000013234416627023550 0ustar zuulzuul00000000000000aodhclient-1.0.0/releasenotes/source/conf.py0000666000175100017510000002125113234416627021151 0ustar zuulzuul00000000000000# -*- coding: utf-8 -*- # 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. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # sys.path.insert(0, os.path.abspath('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'openstackdocstheme', 'reno.sphinxext', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. # source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # openstackdocstheme options repository_name = 'openstack/python-aodhclient' bug_project = 'python-aodhclient' bug_tag = '' project = u'Aodh Client Release Notes' copyright = u'2015-present, Aodh developers' # Release notes are version independent. # The short X.Y version. version = '' # The full version, including alpha/beta/rc tags. release = '' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all # documents. # default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. # add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). # add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. # show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. # keep_warnings = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'openstackdocs' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". # html_title = None # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. # html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. # html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. html_last_updated_fmt = '%Y-%m-%d %H:%M' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True # Custom sidebar templates, maps document names to template names. # html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. # html_additional_pages = {} # If false, no module index is generated. # html_domain_indices = True # If false, no index is generated. # html_use_index = True # If true, the index is split into individual pages for each letter. # html_split_index = False # If true, links to the reST sources are added to the pages. # html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. # html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. # html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). # html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'AodhClientReleaseNotestdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # 'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ ('index', 'PythonAodhClient.tex', u'Aodh Client Release Notes Documentation', u'Aodh developers', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. # latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. # latex_use_parts = False # If true, show page references after internal links. # latex_show_pagerefs = False # If true, show URL addresses after external links. # latex_show_urls = False # Documents to append as an appendix to all manuals. # latex_appendices = [] # If false, no module index is generated. # latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'pythonaodhclient', u'Aodh Client Release Notes Documentation', [u'Aodh developers'], 1) ] # If true, show URL addresses after external links. # man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'PythonAodhClient', u'Aodh Client Release Notes Documentation', u'Aodh developers', 'PythonAodhClient', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. # texinfo_appendices = [] # If false, no module index is generated. # texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. # texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. # texinfo_no_detailmenu = False # -- Options for Internationalization output ------------------------------ locale_dirs = ['locale/'] aodhclient-1.0.0/releasenotes/source/pike.rst0000666000175100017510000000021713234416627021333 0ustar zuulzuul00000000000000=================================== Pike Series Release Notes =================================== .. release-notes:: :branch: stable/pike aodhclient-1.0.0/releasenotes/source/mitaka.rst0000666000175100017510000000023213234416627021646 0ustar zuulzuul00000000000000=================================== Mitaka Series Release Notes =================================== .. release-notes:: :branch: origin/stable/mitaka aodhclient-1.0.0/releasenotes/source/index.rst0000666000175100017510000000042713234416627021515 0ustar zuulzuul00000000000000Welcome to Aodh Client Release Notes documentation! =================================================== Contents ======== .. toctree:: :maxdepth: 2 unreleased pike ocata newton mitaka Indices and tables ================== * :ref:`genindex` * :ref:`search` aodhclient-1.0.0/releasenotes/source/unreleased.rst0000666000175100017510000000015313234416627022531 0ustar zuulzuul00000000000000============================ Current Series Release Notes ============================ .. release-notes:: aodhclient-1.0.0/releasenotes/source/_templates/0000775000175100017510000000000013234417066022002 5ustar zuulzuul00000000000000aodhclient-1.0.0/releasenotes/source/_templates/.placeholder0000666000175100017510000000000013234416627024257 0ustar zuulzuul00000000000000aodhclient-1.0.0/releasenotes/source/ocata.rst0000666000175100017510000000023013234416627021465 0ustar zuulzuul00000000000000=================================== Ocata Series Release Notes =================================== .. release-notes:: :branch: origin/stable/ocata aodhclient-1.0.0/releasenotes/source/newton.rst0000666000175100017510000000023213234416627021712 0ustar zuulzuul00000000000000=================================== Newton Series Release Notes =================================== .. release-notes:: :branch: origin/stable/newton aodhclient-1.0.0/releasenotes/notes/0000775000175100017510000000000013234417066017475 5ustar zuulzuul00000000000000aodhclient-1.0.0/releasenotes/notes/.placeholder0000666000175100017510000000000013234416627021752 0ustar zuulzuul00000000000000aodhclient-1.0.0/releasenotes/notes/add-pagination-support-fcdf1cef0cfa5ca9.yaml0000666000175100017510000000022113234416627027624 0ustar zuulzuul00000000000000--- features: - Add pagination support for aodhclient, users can now use limit, sort and marker when list alarms and show alarm histories. aodhclient-1.0.0/releasenotes/notes/split-alarm-query-and-list-5998020b88ddc9f5.yaml0000666000175100017510000000054713234416627027653 0ustar zuulzuul00000000000000--- upgrade: - Alarm list and query has been split into two separate functions in the SDK layer( CLI user still uses alarm list with --query or --filter as before). deprecations: - Calling alarm list function with query parameter has been deprecated and will be removed in python-aodhclient 0.7.0, please use alarm query function instead. aodhclient-1.0.0/releasenotes/notes/merge-search-to-list-d44cd65ede348c3e.yaml0000666000175100017510000000046113234416627026704 0ustar zuulzuul00000000000000--- features: - The support for alarm search CLI has been dropped. New options for alarm list CLI(--filter and --query) has been added. The new option --query can be used to perform the same operation as the old alarm search CLI, and the new option --filter is used to perform filter query. aodhclient-1.0.0/releasenotes/notes/support-get-set-state-interfaces-67419b925ffd6877.yaml0000666000175100017510000000010113234416627031004 0ustar zuulzuul00000000000000--- features: - Add support of get/set alarm state interfaces. aodhclient-1.0.0/releasenotes/notes/remove-ceilometer-alarms-02049eef189c2812.yaml0000666000175100017510000000047213234416627027346 0ustar zuulzuul00000000000000--- features: - | Ceilometer alarms are no longer supported. upgrade: - | Ceilometer alarms will need to be recreated as alarms that target Gnocchi as storage is not provided in Ceilometer anymore. You must downgrade client if you still continue to use Ceilometer storage in older deployments. aodhclient-1.0.0/releasenotes/notes/osc-support-9f9dae2d2203f307.yaml0000666000175100017510000000012213234416627025072 0ustar zuulzuul00000000000000--- features: - Add support for using Aodh command with python-openstackclient. aodhclient-1.0.0/aodhclient.egg-info/0000775000175100017510000000000013234417066017460 5ustar zuulzuul00000000000000aodhclient-1.0.0/aodhclient.egg-info/dependency_links.txt0000664000175100017510000000000113234417065023525 0ustar zuulzuul00000000000000 aodhclient-1.0.0/aodhclient.egg-info/PKG-INFO0000664000175100017510000000267413234417065020565 0ustar zuulzuul00000000000000Metadata-Version: 1.1 Name: aodhclient Version: 1.0.0 Summary: Python client library for Aodh Home-page: https://docs.openstack.org/python-aodhclient/latest/ Author: OpenStack Author-email: openstack-dev@lists.openstack.org License: UNKNOWN Description-Content-Type: UNKNOWN Description: ============= aodhclient ============= Python bindings to the OpenStack Aodh API This is a client for OpenStack Aodh API. There's :doc:`a Python API ` (the :mod:`aodhclient` module), and a :doc:`command-line script ` (installed as :program:`aodh`). Each implements the entire OpenStack Aodh API. * Free software: Apache license * Documentation: https://docs.openstack.org/python-aodhclient/latest/ * Source: https://git.openstack.org/cgit/openstack/python-aodhclient * Bugs: https://bugs.launchpad.net/python-aodhclient Platform: UNKNOWN Classifier: Environment :: OpenStack Classifier: Intended Audience :: Information Technology Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX :: Linux Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.5 aodhclient-1.0.0/aodhclient.egg-info/requires.txt0000664000175100017510000000045713234417065022065 0ustar zuulzuul00000000000000pbr>=1.4 cliff!=1.16.0,>=1.14.0 osc-lib>=1.0.1 oslo.i18n>=1.5.0 oslo.serialization>=1.4.0 oslo.utils>=2.0.0 keystoneauth1>=1.0.0 six pyparsing [test] coverage>=3.6 oslotest>=1.10.0 reno>=1.6.2 tempest>=10 testrepository>=0.0.18 testtools>=1.4.0 pifpaf[gnocchi]>=0.23 gnocchi[file,postgresql] mock>=1.2 aodhclient-1.0.0/aodhclient.egg-info/pbr.json0000664000175100017510000000005613234417065021136 0ustar zuulzuul00000000000000{"git_version": "86ac8fd", "is_release": true}aodhclient-1.0.0/aodhclient.egg-info/SOURCES.txt0000664000175100017510000000426213234417066021350 0ustar zuulzuul00000000000000.coveragerc .testr.conf AUTHORS CONTRIBUTING.rst ChangeLog HACKING.rst LICENSE README.rst babel.cfg requirements.txt setup.cfg setup.py tox.ini aodhclient/__init__.py aodhclient/client.py aodhclient/exceptions.py aodhclient/i18n.py aodhclient/noauth.py aodhclient/osc.py aodhclient/shell.py aodhclient/utils.py aodhclient.egg-info/PKG-INFO aodhclient.egg-info/SOURCES.txt aodhclient.egg-info/dependency_links.txt aodhclient.egg-info/entry_points.txt aodhclient.egg-info/not-zip-safe aodhclient.egg-info/pbr.json aodhclient.egg-info/requires.txt aodhclient.egg-info/top_level.txt aodhclient/tests/__init__.py aodhclient/tests/functional/__init__.py aodhclient/tests/functional/base.py aodhclient/tests/functional/test_alarm.py aodhclient/tests/functional/test_alarm_history.py aodhclient/tests/functional/test_capabilities.py aodhclient/tests/unit/__init__.py aodhclient/tests/unit/test_alarm_cli.py aodhclient/tests/unit/test_alarm_history.py aodhclient/tests/unit/test_alarm_manager.py aodhclient/tests/unit/test_exceptions.py aodhclient/tests/unit/test_shell.py aodhclient/tests/unit/test_utils.py aodhclient/v2/__init__.py aodhclient/v2/alarm.py aodhclient/v2/alarm_cli.py aodhclient/v2/alarm_history.py aodhclient/v2/alarm_history_cli.py aodhclient/v2/base.py aodhclient/v2/capabilities.py aodhclient/v2/capabilities_cli.py aodhclient/v2/client.py doc/requirements.txt doc/source/api.rst doc/source/conf.py doc/source/contributing.rst doc/source/index.rst doc/source/installation.rst doc/source/shell.rst releasenotes/notes/.placeholder releasenotes/notes/add-pagination-support-fcdf1cef0cfa5ca9.yaml releasenotes/notes/merge-search-to-list-d44cd65ede348c3e.yaml releasenotes/notes/osc-support-9f9dae2d2203f307.yaml releasenotes/notes/remove-ceilometer-alarms-02049eef189c2812.yaml releasenotes/notes/split-alarm-query-and-list-5998020b88ddc9f5.yaml releasenotes/notes/support-get-set-state-interfaces-67419b925ffd6877.yaml releasenotes/source/conf.py releasenotes/source/index.rst releasenotes/source/mitaka.rst releasenotes/source/newton.rst releasenotes/source/ocata.rst releasenotes/source/pike.rst releasenotes/source/unreleased.rst releasenotes/source/_static/.placeholder releasenotes/source/_templates/.placeholderaodhclient-1.0.0/aodhclient.egg-info/entry_points.txt0000664000175100017510000000144713234417065022763 0ustar zuulzuul00000000000000[console_scripts] aodh = aodhclient.shell:main [keystoneauth1.plugin] aodh-noauth = aodhclient.noauth:AodhNoAuthLoader [openstack.alarming.v2] alarm create = aodhclient.v2.alarm_cli:CliAlarmCreate alarm delete = aodhclient.v2.alarm_cli:CliAlarmDelete alarm list = aodhclient.v2.alarm_cli:CliAlarmList alarm show = aodhclient.v2.alarm_cli:CliAlarmShow alarm state get = aodhclient.v2.alarm_cli:CliAlarmStateGet alarm state set = aodhclient.v2.alarm_cli:CliAlarmStateSet alarm update = aodhclient.v2.alarm_cli:CliAlarmUpdate alarm-history search = aodhclient.v2.alarm_history_cli:CliAlarmHistorySearch alarm-history show = aodhclient.v2.alarm_history_cli:CliAlarmHistoryShow alarming capabilities list = aodhclient.v2.capabilities_cli:CliCapabilitiesList [openstack.cli.extension] metric = aodhclient.osc aodhclient-1.0.0/aodhclient.egg-info/top_level.txt0000664000175100017510000000001313234417065022203 0ustar zuulzuul00000000000000aodhclient aodhclient-1.0.0/aodhclient.egg-info/not-zip-safe0000664000175100017510000000000113234417041021677 0ustar zuulzuul00000000000000 aodhclient-1.0.0/ChangeLog0000664000175100017510000001724713234417065015440 0ustar zuulzuul00000000000000CHANGES ======= 1.0.0 ----- * remove threshold alarms * Set the Cliff namespace * Fix doc builds * delete --debug in a shell command * Remove setting of version/release from releasenotes * doc: remove mention of combination alarms * Cleanup setup.cfg * Update reno for stable/pike * Docs: switch to openstackdocstheme * Fix gnocchi/pifpaf requirements * Update documentation URLs * Fix Gnocchi tarball URL * block sphinx 1.6.1 * cleanup coveragerc * tests: stop using Ceilometer legacy resource types * Remove log translations 0.9.0 ----- * Remove upper cap on pbr * Clean deprecated "query" paremeter in alarm.list() * Correct the port number of gnocchi endpoint * Trivial-fix: make the capabilities help message more specific in OSC * Remove the duplicated \_\_version\_\_ definition * Trivial: remove support for py34 * Update reno for stable/ocata * Remove unused test dependency 0.8.0 ----- * Extras usage for test requirements + basic auth against Gnocch * Modified the help info * Enable coverage report in console output * [doc] Note lack of constraints is a choice * Replaces uuid.uuid4 with uuidutils.generate\_uuid() * Bump hacking to 0.12 * Add plug-in summary for osc doc * Enable release notes translation * Add missing pyparsing to requirements.txt * Clean imports in code * Update reno for stable/newton * Remove 'MANIFEST.in' 0.7.0 ----- * Use osc-lib instead of openstackclient * Trival: Remove unused logging import * Fix incorrect string format mapping * Remove discover from test-requirements 0.6.0 ----- * Add Python 3.5 classifier and venv * Add event\_id for alarm-history display * Add pagination support in Aodhclient * Split alarm query and alarm list in SDK layer * Support get/set alarm state interfaces * Add releasenotes for Newton updates * add default value for http\_status in ClientException * fix help text for option --composite-rule * improve threshold & event alarm query formatting * Add explanation for how to get meter name * Add unit test to validate composite alarm args * exceptions: make error code be implicit * Update the home-page with developer documentation * remove tempest test for alarm name unique constraint * Only install hacking in pep8 * shell: treat alarm id as name if it is not uuid like * Bump hacking to 0.11 0.5.0 ----- * add valid choice for alarm type help text * shell: fix meter help string * Allow to start Aodh command with OSC * Prepare compatibility with OSC * fix KeyError when credential is invalid * remove unnecessary slashes * Enable releasenotes documentation * [Trivial] Remove executable privilege of doc/source/conf.py * add mock to test requirement list * refactor code of adding alarm id and name arguments * Switch from deprecated tempest-lib to tempest 0.4.0 ----- * Remove keystonemiddleware dependency * Use pifpaf to setup tests * Remove Babel dependency * format the output of time\_constraints * Add --filter to "alarm list" * Remove unused mailmap file * Support easier query usage for alarm history search * Add name support for show, update and delete * Correct and add examples in docs of CLI * Add --query to alarm list * Clean flake8 paths and unused config options * Don't support "alarm search" and mandatory --type in "alarm list" * tox: remove useless install\_command * Use overtest to run Gnocchi in tests * Trival fix a typo * Fix aodh client fails when command with the arg --time-constraint * Fix the -q/--query in threshold alarm creation * Use assert\_called\_once\_with() in test\_alarm\_cli.py * Fix the wrong error info of parameter resource-type * Fix a minor doc error * Remove unused package requirement of "futurist" 0.3.0 ----- * Use cli.base.execute of tempest-lib * Add composite rule alarm support in aodhclient * Make the alarm list output more concise 0.2.0 ----- * Skip the version 1.16.0 of cliff * Remove unused method * Add abbreviation of --meter-name hint in threshold alarm creation * Return the error message of API request failure * Add some unit test cases * Add gnocchi alarm rules * cleanup existing tests * add alarm history unit test * check the alarm type when list alarm 0.1.0 ----- * add alarm-history interface * clean up docs * add event alarm support * Clean flake8 ignore * support alarm type param * add alarm interface * fix test debug * fix functional tests * drop remaining gnocchi specific code and fix pep8 * remove gnocchi specific tests * remove gnocchi specific commands and set to v2 * more gnocchi to aodh rename cleanup * rename gnocchi to aodh * Make the wheel universal * Allow to set resource type for aggregation * Examples in doc should be workable * Handle rename from dbsync to upgrade * Fixed history parameter having no effect on search * tests: update setup script to use Paste * Add some help messages of Gnocchi commands * metric: fix measures --stop argument * Creates better exceptions for http code 409 * resource: fix help string * tests: do not create a archive policy on setup * resource: define several option for all metric action * benchmark: Add more measurements stats * benchmark: add measures show * metric: rename metric get to show * Set x-roles when noauth is used * Convert keystoneauth exceptions by ours * Fix some spelling typo in manual and help output * Always make resource\_id positional * cli: make resource type non positional * benchmark: use processes rather than threads * benchmark: add support for measures add * metric: change all resource\_id options to -r * benchmark: add get metric * benchmark: rename argument to \`count' * benchmark: add metric create * get gnocchi api version from args/env * noauth: simplify class reference * Add support for /v1/status * shell: remove unused LOG * shell: remove dead code * shell: move command definition to the class using it * metric: change delete to allow deleting several metric at once * Add capabilities support to cli * Remove upper cap on Sphinx * Remove Python 3.3 support * Name the package \`gnocchiclient' * metric: allow to create metric with name and no resource\_id * shell: improve error info * Add six in requirements * shell: fix exception catching on cleanup * Replaces 'archive policy' by 'archive-policy' * Change ignore-errors to ignore\_errors * Remove entry\_points * Don't always load client * Remove now useless build\_url method * Replace keystoneclient by keystoneauth1 * Fix help typo * tox: Allow to pass some OS\_\* variables * Support aggregation accross metrics and resources * Allow CRUD measurements * Allow CRUD metric with an resource\_id and an name * Support CRUD for metric * resource: remove -q for --query it conflicts with --quiet * Allow quoted string with ' in query parser * cli: fix archive policy create output * docs: fix archive policy rule name doc * docs: enhance reference title * docs: delete previous build * Use 'archive policy' instead of 'archivepolicy' * Fix archive policy rule list * ap rule: Use named attributes * Fix archivepolicy list * ap: allows multiple definition and name attributes * test: remove duplicated code * Add archive policy rule commands to cli * Add archive policy commands to cli * Fix py34 tests * doc: fix typo in shell.rst * functional tests: don't require devstack * fixes noauth * doc: fix typo * Allow to disable the authentification layer * doc: Fixing a shell parameter * Allow limit/sort/marker for resource listing * Fixes logging * Allow resource history * Write the base of the documentation * Allow to pass the gnocchi enpoint via cli * Update documentation * Allow search for resource * Allow add/delete metrics with resource * Add ssl/region/timeout/interface parameters * Add functional test for crud resource * Hide useless logging * Add 'delete resource' * Adding resource update * Allow to create resources * Fixes "resource show" * Initial client code * Initial Cookiecutter Commit aodhclient-1.0.0/tox.ini0000666000175100017510000000256213234416627015200 0ustar zuulzuul00000000000000[tox] minversion = 1.6 envlist = py35,py27,pypy,pep8 skipsdist = True [testenv] usedevelop = True setenv = VIRTUAL_ENV={envdir} AODH_CLIENT_EXEC_DIR={envdir}/bin AODH_ENDPOINT=http://localhost:8042 GNOCCHI_ENDPOINT=http://localhost:8041 passenv = GNOCCHI_* AODH_* OS_TEST_TIMEOUT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE # NOTE(tonyb): This project has chosen to *NOT* consume upper-constraints.txt # NOTE(jd): the -e is on its own line so it is passed a separate argument to pip deps = .[test] http://tarballs.openstack.org/aodh/aodh-master.tar.gz#egg=aodh[mysql] commands = pifpaf run aodh -- python setup.py test --slowest --testr-args='{posargs}' [testenv:pep8] deps = hacking<0.13,>=0.12 commands = flake8 [testenv:venv] # Used by openstack-infra to build the doc deps = -r{toxinidir}/doc/requirements.txt commands = {posargs} [testenv:cover] commands = python setup.py test --coverage --testr-args='{posargs}' coverage report [testenv:releasenotes] commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html [testenv:docs] deps = -r{toxinidir}/doc/requirements.txt commands = rm -rf doc/source/ref python setup.py build_sphinx [testenv:debug] commands = pifpaf --debug run aodh -- oslo_debug_helper {posargs} [flake8] show-source = True exclude=.venv,.git,.tox,dist,doc,*egg,build aodhclient-1.0.0/setup.py0000666000175100017510000000177713234416627015406 0ustar zuulzuul00000000000000# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # 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. # THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT import setuptools # In python < 2.7.4, a lazy loading of package `pbr` will break # setuptools if some other modules registered functions in `atexit`. # solution from: http://bugs.python.org/issue15881#msg170215 try: import multiprocessing # noqa except ImportError: pass setuptools.setup( setup_requires=['pbr'], pbr=True) aodhclient-1.0.0/PKG-INFO0000664000175100017510000000267413234417066014762 0ustar zuulzuul00000000000000Metadata-Version: 1.1 Name: aodhclient Version: 1.0.0 Summary: Python client library for Aodh Home-page: https://docs.openstack.org/python-aodhclient/latest/ Author: OpenStack Author-email: openstack-dev@lists.openstack.org License: UNKNOWN Description-Content-Type: UNKNOWN Description: ============= aodhclient ============= Python bindings to the OpenStack Aodh API This is a client for OpenStack Aodh API. There's :doc:`a Python API ` (the :mod:`aodhclient` module), and a :doc:`command-line script ` (installed as :program:`aodh`). Each implements the entire OpenStack Aodh API. * Free software: Apache license * Documentation: https://docs.openstack.org/python-aodhclient/latest/ * Source: https://git.openstack.org/cgit/openstack/python-aodhclient * Bugs: https://bugs.launchpad.net/python-aodhclient Platform: UNKNOWN Classifier: Environment :: OpenStack Classifier: Intended Audience :: Information Technology Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX :: Linux Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.5 aodhclient-1.0.0/requirements.txt0000666000175100017510000000064413234416627017150 0ustar zuulzuul00000000000000# The order of packages is significant, because pip processes them in the order # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. pbr>=1.4 cliff!=1.16.0,>=1.14.0 # Apache-2.0 osc-lib>=1.0.1 # Apache-2.0 oslo.i18n>=1.5.0 # Apache-2.0 oslo.serialization>=1.4.0 # Apache-2.0 oslo.utils>=2.0.0 # Apache-2.0 keystoneauth1>=1.0.0 six pyparsing aodhclient-1.0.0/AUTHORS0000664000175100017510000000260013234417065014721 0ustar zuulzuul00000000000000Andreas Jaeger Cao Xuan Hoang Chaozhe.Chen Doug Hellmann Eyal Hanxi Liu Jon Schlueter Julien Danjou KATO Tomoyuki Kevin_Zheng Mehdi ABAAKOUK Mehdi Abaakouk Mehdi Abaakouk Monty Taylor OpenStack Release Bot PanFengyun Pradeep Kilambi Rui Yuan Dou Stéphane Albert Swapnil Kulkarni (coolsvap) Thomas Bechtold Tony Breeds Tovin Seven Zhao Lei ZhiQiang Fan Zi Lian Ji Zuul gord chung gordon chung houweichao lipan liusheng liyuanzhen venkatamahesh xialinjuan xiaozhuangqing zhangguoqing zhangyangyang aodhclient-1.0.0/.coveragerc0000666000175100017510000000010713234416627015777 0ustar zuulzuul00000000000000[run] branch = True source = aodhclient [report] ignore_errors = True aodhclient-1.0.0/README.rst0000666000175100017510000000102713234416627015347 0ustar zuulzuul00000000000000============= aodhclient ============= Python bindings to the OpenStack Aodh API This is a client for OpenStack Aodh API. There's :doc:`a Python API ` (the :mod:`aodhclient` module), and a :doc:`command-line script ` (installed as :program:`aodh`). Each implements the entire OpenStack Aodh API. * Free software: Apache license * Documentation: https://docs.openstack.org/python-aodhclient/latest/ * Source: https://git.openstack.org/cgit/openstack/python-aodhclient * Bugs: https://bugs.launchpad.net/python-aodhclient aodhclient-1.0.0/babel.cfg0000666000175100017510000000002113234416627015377 0ustar zuulzuul00000000000000[python: **.py] aodhclient-1.0.0/setup.cfg0000666000175100017510000000425313234417066015503 0ustar zuulzuul00000000000000[metadata] name = aodhclient summary = Python client library for Aodh description-file = README.rst author = OpenStack author-email = openstack-dev@lists.openstack.org home-page = https://docs.openstack.org/python-aodhclient/latest/ classifier = Environment :: OpenStack Intended Audience :: Information Technology Intended Audience :: System Administrators License :: OSI Approved :: Apache Software License Operating System :: POSIX :: Linux Programming Language :: Python Programming Language :: Python :: 2 Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Programming Language :: Python :: 3.5 [files] packages = aodhclient [extras] test = coverage>=3.6 oslotest>=1.10.0 # Apache-2.0 reno>=1.6.2 # Apache2 tempest>=10 testrepository>=0.0.18 testtools>=1.4.0 pifpaf[gnocchi]>=0.23 gnocchi[postgresql,file] mock>=1.2 # BSD [entry_points] console_scripts = aodh = aodhclient.shell:main keystoneauth1.plugin = aodh-noauth = aodhclient.noauth:AodhNoAuthLoader openstack.cli.extension = metric = aodhclient.osc openstack.alarming.v2 = alarm create = aodhclient.v2.alarm_cli:CliAlarmCreate alarm list = aodhclient.v2.alarm_cli:CliAlarmList alarm show = aodhclient.v2.alarm_cli:CliAlarmShow alarm delete = aodhclient.v2.alarm_cli:CliAlarmDelete alarm update = aodhclient.v2.alarm_cli:CliAlarmUpdate alarm state get = aodhclient.v2.alarm_cli:CliAlarmStateGet alarm state set = aodhclient.v2.alarm_cli:CliAlarmStateSet alarm-history search = aodhclient.v2.alarm_history_cli:CliAlarmHistorySearch alarm-history show = aodhclient.v2.alarm_history_cli:CliAlarmHistoryShow alarming capabilities list = aodhclient.v2.capabilities_cli:CliCapabilitiesList [build_sphinx] source-dir = doc/source build-dir = doc/build all_files = 1 [upload_sphinx] upload-dir = doc/build/html [compile_catalog] directory = aodhclient/locale domain = aodhclient [update_catalog] domain = aodhclient output_dir = aodhclient/locale input_file = aodhclient/locale/aodhclient.pot [extract_messages] keywords = _ gettext ngettext l_ lazy_gettext mapping_file = babel.cfg output_file = aodhclient/locale/aodhclient.pot [wheel] universal = 1 [egg_info] tag_build = tag_date = 0 aodhclient-1.0.0/.testr.conf0000666000175100017510000000054113234416627015746 0ustar zuulzuul00000000000000[DEFAULT] test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./aodhclient/tests} $LISTOPT $IDOPTION test_id_option=--load-list $IDFILE test_list_option=--list aodhclient-1.0.0/CONTRIBUTING.rst0000666000175100017510000000122513234416627016321 0ustar zuulzuul00000000000000If you would like to contribute to the development of OpenStack, you must follow the steps in this page: http://docs.openstack.org/infra/manual/developers.html If you already have a good understanding of how the system works and your OpenStack accounts are set up, you can skip to the development workflow section of this documentation to learn how changes to OpenStack should be submitted for review via the Gerrit tool: http://docs.openstack.org/infra/manual/developers.html#development-workflow Pull requests submitted through GitHub will be ignored. Bugs should be filed on Launchpad, not GitHub: https://bugs.launchpad.net/python-aodhclient aodhclient-1.0.0/LICENSE0000666000175100017510000002363713234416627014700 0ustar zuulzuul00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. aodhclient-1.0.0/doc/0000775000175100017510000000000013234417066014421 5ustar zuulzuul00000000000000aodhclient-1.0.0/doc/requirements.txt0000666000175100017510000000007413234416627017712 0ustar zuulzuul00000000000000sphinx>=1.6.2 # BSD openstackdocstheme>=1.11.0 # Apache-2.0 aodhclient-1.0.0/doc/source/0000775000175100017510000000000013234417066015721 5ustar zuulzuul00000000000000aodhclient-1.0.0/doc/source/conf.py0000666000175100017510000001024513234416627017226 0ustar zuulzuul00000000000000# -*- coding: utf-8 -*- # 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. import os import sys BASE_DIR = os.path.dirname(os.path.abspath(__file__)) ROOT = os.path.abspath(os.path.join(BASE_DIR, "..", "..")) sys.path.insert(0, ROOT) sys.path.insert(0, BASE_DIR) def gen_ref(ver, title, names): refdir = os.path.join(BASE_DIR, "ref") pkg = "aodhclient" if ver: pkg = "%s.%s" % (pkg, ver) refdir = os.path.join(refdir, ver) if not os.path.exists(refdir): os.makedirs(refdir) idxpath = os.path.join(refdir, "index.rst") with open(idxpath, "w") as idx: idx.write(("%(title)s\n" "%(signs)s\n" "\n" ".. toctree::\n" " :maxdepth: 1\n" "\n") % {"title": title, "signs": "=" * len(title)}) for name in names: idx.write(" %s\n" % name) rstpath = os.path.join(refdir, "%s.rst" % name) with open(rstpath, "w") as rst: rst.write(("%(title)s\n" "%(signs)s\n" "\n" ".. automodule:: %(pkg)s.%(name)s\n" " :members:\n" " :undoc-members:\n" " :show-inheritance:\n" " :noindex:\n") % {"title": " ".join([n.capitalize() for n in name.split("_")]), "signs": "=" * len(name), "pkg": pkg, "name": name}) gen_ref("v2", "Version 2 API", ["client"]) # -- General configuration ---------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx.ext.autodoc', 'openstackdocstheme', #'sphinx.ext.intersphinx', ] # autodoc generation is a bit aggressive and a nuisance when doing heavy # text edit cycles. # execute "export SPHINX_DEBUG=1" in your terminal to disable # The suffix of source filenames. source_suffix = '.rst' # The master toctree document. master_doc = 'index' # openstackdocstheme options repository_name = 'openstack/python-aodhclient' bug_project = 'python-aodhclient' bug_tag = '' project = u'aodhclient' copyright = u'2015, OpenStack Foundation' # If true, '()' will be appended to :func: etc. cross-reference text. add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). add_module_names = True # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # -- Options for HTML output -------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. # html_theme_path = ["."] # html_theme = '_theme' # html_static_path = ['static'] html_theme = 'openstackdocs' html_last_updated_fmt = '%Y-%m-%d %H:%M' # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = ['_theme'] # Output file base name for HTML help builder. htmlhelp_basename = '%sdoc' % project # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass # [howto/manual]). latex_documents = [ ('index', '%s.tex' % project, u'%s Documentation' % project, u'OpenStack Foundation', 'manual'), ] # Example configuration for intersphinx: refer to the Python standard library. #intersphinx_mapping = {'http://docs.python.org/': None} aodhclient-1.0.0/doc/source/index.rst0000666000175100017510000000220013234416627017560 0ustar zuulzuul00000000000000.. aodhclient documentation master file, created by sphinx-quickstart on Tue Jul 9 22:26:36 2013. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. Python bindings to the Aodh API =============================== This is a client for Aodh API. There's :doc:`a Python API ` (the :mod:`aodhclient` module), and a :doc:`command-line script ` (installed as :program:`aodh`). Each implements the entire Aodh API. .. warning:: This is a new client to interact with Aodh API. There may be differences in functionality, syntax, and command line output when compared with the alarm functionality provided by ceilometerclient. .. seealso:: You may want to read the `Aodh Developer Guide`__ -- the overview, at least -- to get an idea of the concepts. By understanding the concepts this library should make more sense. __ https://docs.openstack.org/aodh/latest/ Contents: .. toctree:: :maxdepth: 2 installation shell api contributing Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` aodhclient-1.0.0/doc/source/api.rst0000666000175100017510000000064613234416627017236 0ustar zuulzuul00000000000000The :mod:`aodhclient` Python API ================================ .. module:: aodhclient :synopsis: A client for the Aodh API. .. currentmodule:: aodhclient Usage ----- To use aodhclient in a project:: >>> from aodhclient.v2 import client >>> aodh = client.Client(...) >>> aodh.alarm.list() Reference --------- For more information, see the reference: .. toctree:: :maxdepth: 2 ref/v2/index aodhclient-1.0.0/doc/source/shell.rst0000666000175100017510000000506413234416627017573 0ustar zuulzuul00000000000000The :program:`aodh` shell utility ========================================= .. program:: aodh .. highlight:: bash The :program:`aodh` shell utility interacts with Aodh API from the command line. It supports the entirety of the Aodh API. You'll need to provide :program:`aodh` with your OpenStack credentials. You can do this with the :option:`--os-username`, :option:`--os-password`, :option:`--os-tenant-id` and :option:`--os-auth-url` options, but it's easier to just set them as environment variables: .. envvar:: OS_USERNAME Your OpenStack username. .. envvar:: OS_PASSWORD Your password. .. envvar:: OS_TENANT_NAME Project to work on. .. envvar:: OS_AUTH_URL The OpenStack auth server URL (keystone). For example, in Bash you would use:: export OS_USERNAME=user export OS_PASSWORD=pass export OS_TENANT_NAME=myproject export OS_AUTH_URL=http://auth.example.com:5000/v2.0 The command line tool will attempt to reauthenticate using your provided credentials for every request. You can override this behavior by manually supplying an auth token using :option:`--aodh-endpoint` and :option:`--os-auth-token`. You can alternatively set these environment variables:: export AODH_ENDPOINT=http://aodh.example.org:8041 export OS_AUTH_PLUGIN=token export OS_AUTH_TOKEN=3bcc3d3a03f44e3d8377f9247b0ad155 Also, if the server doesn't support authentication, you can provide :option:`--os-auth-plugon` aodh-noauth, :option:`--aodh-endpoint`, :option:`--user-id` and :option:`--project-id`. You can alternatively set these environment variables:: export OS_AUTH_PLUGIN=aodh-noauth export AODH_ENDPOINT=http://aodh.example.org:8041 export AODH_USER_ID=99aae-4dc2-4fbc-b5b8-9688c470d9cc export AODH_PROJECT_ID=c8d27445-48af-457c-8e0d-1de7103eae1f From there, all shell commands take the form:: aodh [arguments...] Run :program:`aodh help` to get a full list of all possible commands, and run :program:`aodh help ` to get detailed help for that command. Examples -------- Create an alarm:: aodh alarm create -t gnocchi_resources_threshold --name alarm1 \ --metric cpu_util --threshold 5 --resource_id \ --resource_type generic --aggregation_method mean --project-id List alarms:: aodh alarm list List alarm with query parameters:: aodh alarm list --query "state=alarm and type=gnocchi_resources_threshold" Show an alarm's history:: aodh alarm-history show Search alarm history data:: aodh alarm-history search --query 'timestamp>"2016-03-09T01:22:35"' aodhclient-1.0.0/doc/source/installation.rst0000666000175100017510000000013413234416627021156 0ustar zuulzuul00000000000000============ Installation ============ At the command line:: $ pip install aodhclient aodhclient-1.0.0/doc/source/contributing.rst0000666000175100017510000000011313234416627021161 0ustar zuulzuul00000000000000============ Contributing ============ .. include:: ../../CONTRIBUTING.rst aodhclient-1.0.0/HACKING.rst0000666000175100017510000000022113234416627015451 0ustar zuulzuul00000000000000aodhclient Style Commandments ================================ Read the OpenStack Style Commandments https://docs.openstack.org/hacking/latest/ aodhclient-1.0.0/aodhclient/0000775000175100017510000000000013234417066015766 5ustar zuulzuul00000000000000aodhclient-1.0.0/aodhclient/client.py0000666000175100017510000000310113234416627017615 0ustar zuulzuul00000000000000# 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. from keystoneauth1 import adapter from oslo_utils import importutils from aodhclient import exceptions def Client(version, *args, **kwargs): module = 'aodhclient.v%s.client' % version module = importutils.import_module(module) client_class = getattr(module, 'Client') return client_class(*args, **kwargs) class SessionClient(adapter.Adapter): def request(self, url, method, **kwargs): kwargs.setdefault('headers', kwargs.get('headers', {})) # NOTE(sileht): The standard call raises errors from # keystoneauth, where we need to raise the aodhclient errors. raise_exc = kwargs.pop('raise_exc', True) resp = super(SessionClient, self).request(url, method, raise_exc=False, **kwargs) if raise_exc and resp.status_code >= 400: raise exceptions.from_response(resp, url, method) return resp aodhclient-1.0.0/aodhclient/utils.py0000666000175100017510000001446013234416627017511 0ustar zuulzuul00000000000000# -*- encoding: utf-8 -*- # # 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. import re from six.moves.urllib import parse as urllib_parse import pyparsing as pp uninary_operators = ("not", ) binary_operator = (u">=", u"<=", u"!=", u">", u"<", u"=", u"==", u"eq", u"ne", u"lt", u"gt", u"ge", u"le") multiple_operators = (u"and", u"or") operator = pp.Regex(u"|".join(binary_operator)) null = pp.Regex("None|none|null").setParseAction(pp.replaceWith(None)) boolean = "False|True|false|true" boolean = pp.Regex(boolean).setParseAction(lambda t: t[0].lower() == "true") hex_string = lambda n: pp.Word(pp.hexnums, exact=n) uuid = pp.Combine(hex_string(8) + ("-" + hex_string(4)) * 3 + "-" + hex_string(12)) number = r"[+-]?\d+(:?\.\d*)?(:?[eE][+-]?\d+)?" number = pp.Regex(number).setParseAction(lambda t: float(t[0])) identifier = pp.Word(pp.alphas, pp.alphanums + "_") quoted_string = pp.QuotedString('"') | pp.QuotedString("'") comparison_term = pp.Forward() in_list = pp.Group(pp.Suppress('[') + pp.Optional(pp.delimitedList(comparison_term)) + pp.Suppress(']'))("list") comparison_term << (null | boolean | uuid | identifier | number | quoted_string) condition = pp.Group(comparison_term + operator + comparison_term) expr = pp.operatorPrecedence(condition, [ ("not", 1, pp.opAssoc.RIGHT, ), ("and", 2, pp.opAssoc.LEFT, ), ("or", 2, pp.opAssoc.LEFT, ), ]) OP_LOOKUP = {'!=': 'ne', '>=': 'ge', '<=': 'le', '>': 'gt', '<': 'lt', '=': 'eq'} OP_LOOKUP_KEYS = '|'.join(sorted(OP_LOOKUP.keys(), key=len, reverse=True)) OP_SPLIT_RE = re.compile(r'(%s)' % OP_LOOKUP_KEYS) def _parsed_query2dict(parsed_query): result = None while parsed_query: part = parsed_query.pop() if part in binary_operator: result = {part: {parsed_query.pop(): result}} elif part in multiple_operators: if result.get(part): result[part].append( _parsed_query2dict(parsed_query.pop())) else: result = {part: [result]} elif part in uninary_operators: result = {part: result} elif isinstance(part, pp.ParseResults): kind = part.getName() if kind == "list": res = part.asList() else: res = _parsed_query2dict(part) if result is None: result = res elif isinstance(result, dict): list(result.values())[0].append(res) else: result = part return result def search_query_builder(query): parsed_query = expr.parseString(query)[0] return _parsed_query2dict(parsed_query) def list2cols(cols, objs): return cols, [tuple([o[k] for k in cols]) for o in objs] def format_string_list(objs, field): objs[field] = ", ".join(objs[field]) def format_dict_list(objs, field): objs[field] = "\n".join( "- " + ", ".join("%s: %s" % (k, v) for k, v in elem.items()) for elem in objs[field]) def format_move_dict_to_root(obj, field): for attr in obj[field]: obj["%s/%s" % (field, attr)] = obj[field][attr] del obj[field] def format_archive_policy(ap): format_dict_list(ap, "definition") format_string_list(ap, "aggregation_methods") def dict_from_parsed_args(parsed_args, attrs): d = {} for attr in attrs: value = getattr(parsed_args, attr) if value is not None: d[attr] = value return d def dict_to_querystring(objs): return "&".join(["%s=%s" % (k, v) for k, v in objs.items() if v is not None]) def cli_to_array(cli_query): """Convert CLI list of queries to the Python API format. This will convert the following: "this<=34;that=string::foo" to "[{field=this,op=le,value=34,type=''}, {field=that,op=eq,value=foo,type=string}]" """ opts = [] queries = cli_query.split(';') for q in queries: try: field, q_operator, type_value = OP_SPLIT_RE.split(q, maxsplit=1) except ValueError: raise ValueError('Invalid or missing operator in query %(q)s,' 'the supported operators are: %(k)s' % {'q': q, 'k': OP_LOOKUP.keys()}) if not field: raise ValueError('Missing field in query %s' % q) if not type_value: raise ValueError('Missing value in query %s' % q) opt = dict(field=field, op=OP_LOOKUP[q_operator]) if '::' not in type_value: opt['type'], opt['value'] = '', type_value else: opt['type'], _, opt['value'] = type_value.partition('::') if opt['type'] and opt['type'] not in ( 'string', 'integer', 'float', 'datetime', 'boolean'): err = ('Invalid value type %(type)s, the type of value' 'should be one of: integer, string, float, datetime,' ' boolean.' % opt) raise ValueError(err) opts.append(opt) return opts def get_pagination_options(limit=None, marker=None, sorts=None): options = [] if limit: options.append("limit=%d" % limit) if marker: options.append("marker=%s" % urllib_parse.quote(marker)) for sort in sorts or []: options.append("sort=%s" % urllib_parse.quote(sort)) return "&".join(options) def get_client(obj): if hasattr(obj.app, 'client_manager'): # NOTE(liusheng): cliff objects loaded by OSC return obj.app.client_manager.alarming else: # TODO(liusheng): Remove this when OSC is able # to install the aodh client binary itself return obj.app.client aodhclient-1.0.0/aodhclient/i18n.py0000666000175100017510000000135513234416627017127 0ustar zuulzuul00000000000000# 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. import oslo_i18n as i18n _translators = i18n.TranslatorFactory(domain='aodhclient') # The primary translation function using the well-known name "_" _ = _translators.primary aodhclient-1.0.0/aodhclient/v2/0000775000175100017510000000000013234417066016315 5ustar zuulzuul00000000000000aodhclient-1.0.0/aodhclient/v2/capabilities.py0000666000175100017510000000142713234416627021330 0ustar zuulzuul00000000000000# # 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. from aodhclient.v2 import base class CapabilitiesManager(base.Manager): cap_url = "v2/capabilities/" def list(self): """List capabilities """ return self._get(self.cap_url).json() aodhclient-1.0.0/aodhclient/v2/client.py0000666000175100017510000000254513234416627020157 0ustar zuulzuul00000000000000# Copyright 2012 OpenStack Foundation # All Rights Reserved. # # 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. from aodhclient import client from aodhclient.v2 import alarm from aodhclient.v2 import alarm_history from aodhclient.v2 import capabilities class Client(object): """Client for the Aodh v2 API. :param string session: session :type session: :py:class:`keystoneauth.adapter.Adapter` """ def __init__(self, session=None, service_type='alarming', **kwargs): """Initialize a new client for the Aodh v2 API.""" self.api = client.SessionClient(session, service_type=service_type, **kwargs) self.alarm = alarm.AlarmManager(self) self.alarm_history = alarm_history.AlarmHistoryManager(self) self.capabilities = capabilities.CapabilitiesManager(self) aodhclient-1.0.0/aodhclient/v2/alarm_history.py0000666000175100017510000000356613234416627021562 0ustar zuulzuul00000000000000# # 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. from oslo_serialization import jsonutils from aodhclient import utils from aodhclient.v2 import base class AlarmHistoryManager(base.Manager): url = "v2/alarms/%s/history" def get(self, alarm_id, limit=None, marker=None, sorts=None): """Get history of an alarm :param alarm_id: ID of the alarm :type alarm_id: str :param limit: maximum number of resources to return :type limit: int :param marker: the last item of the previous page; we return the next results after this value. :type marker: str :param sorts: list of resource attributes to order by. :type sorts: list of str """ pagination = utils.get_pagination_options(limit, marker, sorts) self.url = self.url % alarm_id if pagination: self.url = "%s?%s" % (self.url, pagination) return self._get(self.url).json() def search(self, query=None): """List of history matching corresponding query :param query: The query dictionary :type query: dict """ query = {'filter': query} if query else {} url = "v2/query/alarms/history" return self._post(url, headers={'Content-Type': "application/json"}, data=jsonutils.dumps(query)).json() aodhclient-1.0.0/aodhclient/v2/__init__.py0000666000175100017510000000000013234416627020420 0ustar zuulzuul00000000000000aodhclient-1.0.0/aodhclient/v2/alarm_history_cli.py0000666000175100017510000000543213234416627022403 0ustar zuulzuul00000000000000# # 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. from cliff import lister from oslo_serialization import jsonutils from aodhclient import utils class CliAlarmHistorySearch(lister.Lister): """Show history for all alarms based on query""" COLS = ('alarm_id', 'timestamp', 'type', 'detail') def get_parser(self, prog_name): parser = super(CliAlarmHistorySearch, self).get_parser(prog_name) parser.add_argument("--query", help="Rich query supported by aodh, " "e.g. project_id!=my-id " "user_id=foo or user_id=bar"), return parser def take_action(self, parsed_args): query = None if parsed_args.query: query = jsonutils.dumps( utils.search_query_builder(parsed_args.query)) history = utils.get_client(self).alarm_history.search( query=query) return utils.list2cols(self.COLS, history) class CliAlarmHistoryShow(lister.Lister): """Show history for an alarm""" COLS = ('timestamp', 'type', 'detail', 'event_id') def get_parser(self, prog_name): parser = super(CliAlarmHistoryShow, self).get_parser(prog_name) parser.add_argument("alarm_id", help="ID of an alarm") parser.add_argument("--limit", type=int, metavar="", help="Number of resources to return " "(Default is server default)") parser.add_argument("--marker", metavar="", help="Last item of the previous listing. " "Return the next results after this value," "the supported marker is event_id.") parser.add_argument("--sort", action="append", metavar="", help="Sort of resource attribute. " "e.g. timestamp:desc") return parser def take_action(self, parsed_args): history = utils.get_client(self).alarm_history.get( alarm_id=parsed_args.alarm_id, sorts=parsed_args.sort, limit=parsed_args.limit, marker=parsed_args.marker) return utils.list2cols(self.COLS, history) aodhclient-1.0.0/aodhclient/v2/alarm_cli.py0000666000175100017510000005574513234416627020636 0ustar zuulzuul00000000000000# # 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. import argparse from cliff import command from cliff import lister from cliff import show from oslo_serialization import jsonutils from oslo_utils import strutils from oslo_utils import uuidutils from aodhclient import exceptions from aodhclient.i18n import _ from aodhclient import utils ALARM_TYPES = ['event', 'composite', 'gnocchi_resources_threshold', 'gnocchi_aggregation_by_metrics_threshold', 'gnocchi_aggregation_by_resources_threshold'] ALARM_STATES = ['ok', 'alarm', 'insufficient data'] ALARM_SEVERITY = ['low', 'moderate', 'critical'] ALARM_OPERATORS = ['lt', 'le', 'eq', 'ne', 'ge', 'gt'] ALARM_OP_MAP = dict(zip(ALARM_OPERATORS, ('<', '<=', '=', '!=', '>=', '>'))) ALARM_LIST_COLS = ['alarm_id', 'type', 'name', 'state', 'severity', 'enabled'] class CliAlarmList(lister.Lister): """List alarms""" @staticmethod def split_filter_param(param): key, eq_op, value = param.partition('=') if not eq_op: msg = 'Malformed parameter(%s). Use the key=value format.' % param raise ValueError(msg) return key, value def get_parser(self, prog_name): parser = super(CliAlarmList, self).get_parser(prog_name) exclusive_group = parser.add_mutually_exclusive_group() exclusive_group.add_argument("--query", help="Rich query supported by aodh, " "e.g. project_id!=my-id " "user_id=foo or user_id=bar") exclusive_group.add_argument('--filter', dest='filter', metavar='', type=self.split_filter_param, action='append', help='Filter parameters to apply on' ' returned alarms.') parser.add_argument("--limit", type=int, metavar="", help="Number of resources to return " "(Default is server default)") parser.add_argument("--marker", metavar="", help="Last item of the previous listing. " "Return the next results after this value," "the supported marker is alarm_id.") parser.add_argument("--sort", action="append", metavar="", help="Sort of resource attribute, " "e.g. name:asc") return parser def take_action(self, parsed_args): if parsed_args.query: if any([parsed_args.limit, parsed_args.sort, parsed_args.marker]): raise exceptions.CommandError( "Query and pagination options are mutually " "exclusive.") query = jsonutils.dumps( utils.search_query_builder(parsed_args.query)) alarms = utils.get_client(self).alarm.query(query=query) else: filters = dict(parsed_args.filter) if parsed_args.filter else None alarms = utils.get_client(self).alarm.list( filters=filters, sorts=parsed_args.sort, limit=parsed_args.limit, marker=parsed_args.marker) return utils.list2cols(ALARM_LIST_COLS, alarms) def _format_alarm(alarm): if alarm.get('composite_rule'): composite_rule = jsonutils.dumps(alarm['composite_rule'], indent=2) alarm['composite_rule'] = composite_rule return alarm for alarm_type in ALARM_TYPES: if alarm.get('%s_rule' % alarm_type): alarm.update(alarm.pop('%s_rule' % alarm_type)) if alarm["time_constraints"]: alarm["time_constraints"] = jsonutils.dumps(alarm["time_constraints"], sort_keys=True, indent=2) # only works for event alarm if isinstance(alarm.get('query'), list): query_rows = [] for q in alarm['query']: op = ALARM_OP_MAP.get(q['op'], q['op']) query_rows.append('%s %s %s' % (q['field'], op, q['value'])) alarm['query'] = ' AND\n'.join(query_rows) return alarm def _find_alarm_by_name(client, name): # then try to get entity as name query = jsonutils.dumps({"=": {"name": name}}) alarms = client.alarm.query(query) if len(alarms) > 1: msg = (_("Multiple alarms matches found for '%s', " "use an ID to be more specific.") % name) raise exceptions.NoUniqueMatch(msg) elif not alarms: msg = (_("Alarm %s not found") % name) raise exceptions.NotFound(msg) else: return alarms[0] def _find_alarm_id_by_name(client, name): alarm = _find_alarm_by_name(client, name) return alarm['alarm_id'] def _check_name_and_id_coexist(parsed_args, action): if parsed_args.id and parsed_args.name: raise exceptions.CommandError( "You should provide only one of " "alarm ID and alarm name(--name) " "to %s an alarm." % action) def _check_name_and_id_exist(parsed_args, action): if not parsed_args.id and not parsed_args.name: msg = (_("You need to specify one of " "alarm ID and alarm name(--name) " "to %s an alarm.") % action) raise exceptions.CommandError(msg) def _check_name_and_id(parsed_args, action): _check_name_and_id_coexist(parsed_args, action) _check_name_and_id_exist(parsed_args, action) def _add_name_to_parser(parser, required=False): parser.add_argument('--name', metavar='', required=required, help='Name of the alarm') return parser def _add_id_to_parser(parser): parser.add_argument("id", nargs='?', metavar='', help="ID or name of an alarm.") return parser class CliAlarmShow(show.ShowOne): """Show an alarm""" def get_parser(self, prog_name): return _add_name_to_parser( _add_id_to_parser( super(CliAlarmShow, self).get_parser(prog_name))) def take_action(self, parsed_args): _check_name_and_id(parsed_args, 'query') c = utils.get_client(self) if parsed_args.name: alarm = _find_alarm_by_name(c, parsed_args.name) else: if uuidutils.is_uuid_like(parsed_args.id): try: alarm = c.alarm.get(alarm_id=parsed_args.id) except exceptions.NotFound: # Maybe it's a name alarm = _find_alarm_by_name(c, parsed_args.id) else: alarm = _find_alarm_by_name(c, parsed_args.id) return self.dict2columns(_format_alarm(alarm)) class CliAlarmCreate(show.ShowOne): """Create an alarm""" create = True def get_parser(self, prog_name): parser = _add_name_to_parser( super(CliAlarmCreate, self).get_parser(prog_name), required=self.create) parser.add_argument('-t', '--type', metavar='', required=self.create, choices=ALARM_TYPES, help='Type of alarm, should be one of: ' '%s.' % ', '.join(ALARM_TYPES)) parser.add_argument('--project-id', metavar='', help='Project to associate with alarm ' '(configurable by admin users only)') parser.add_argument('--user-id', metavar='', help='User to associate with alarm ' '(configurable by admin users only)') parser.add_argument('--description', metavar='', help='Free text description of the alarm') parser.add_argument('--state', metavar='', choices=ALARM_STATES, help='State of the alarm, one of: ' + str(ALARM_STATES)) parser.add_argument('--severity', metavar='', choices=ALARM_SEVERITY, help='Severity of the alarm, one of: ' + str(ALARM_SEVERITY)) parser.add_argument('--enabled', type=strutils.bool_from_string, metavar='{True|False}', help=('True if alarm evaluation is enabled')) parser.add_argument('--alarm-action', dest='alarm_actions', metavar='', action='append', help=('URL to invoke when state transitions to ' 'alarm. May be used multiple times')) parser.add_argument('--ok-action', dest='ok_actions', metavar='', action='append', help=('URL to invoke when state transitions to ' 'OK. May be used multiple times')) parser.add_argument('--insufficient-data-action', dest='insufficient_data_actions', metavar='', action='append', help=('URL to invoke when state transitions to ' 'insufficient data. May be used multiple ' 'times')) parser.add_argument( '--time-constraint', dest='time_constraints', metavar='