Deprecate collector mappings

Change-Id: I4c93d5829ebc3a0cb81ce1a3e464d16cb6438341
Task: 6587
Story: 2001612
This commit is contained in:
Luka Peschke 2018-03-07 12:07:17 +01:00
parent acf1978421
commit 0b80c76c3b
2 changed files with 12 additions and 0 deletions

View File

@ -15,6 +15,7 @@
#
# @author: Stéphane Albert
#
from oslo_log import log as logging
import pecan
from pecan import rest
import six
@ -25,6 +26,8 @@ from cloudkitty.api.v1.datamodels import collector as collector_models
from cloudkitty.common import policy
from cloudkitty.db import api as db_api
LOG = logging.getLogger(__name__)
class MappingController(rest.RestController):
"""REST Controller managing service to collector mappings."""
@ -39,6 +42,7 @@ class MappingController(rest.RestController):
:param service: Name of the service to filter on.
"""
LOG.warning("Collector mappings are deprecated and shouldn't be used.")
policy.authorize(pecan.request.context, 'collector:get_mapping', {})
try:
mapping = self._db.get_mapping(service)
@ -55,6 +59,7 @@ class MappingController(rest.RestController):
:param collector: Filter on the collector name.
:return: Service to collector mappings collection.
"""
LOG.warning("Collector mappings are deprecated and shouldn't be used.")
policy.authorize(pecan.request.context, 'collector:list_mappings', {})
mappings = [collector_models.ServiceToCollectorMapping(
**mapping.as_dict())
@ -71,6 +76,7 @@ class MappingController(rest.RestController):
:param collector: Name of the collector to apply mapping on.
:param service: Name of the service to apply mapping on.
"""
LOG.warning("Collector mappings are deprecated and shouldn't be used.")
policy.authorize(pecan.request.context, 'collector:manage_mapping', {})
new_mapping = self._db.set_mapping(service, collector)
return collector_models.ServiceToCollectorMapping(
@ -85,6 +91,7 @@ class MappingController(rest.RestController):
:param service: Name of the service to filter on.
"""
LOG.warning("Collector mappings are deprecated and shouldn't be used.")
policy.authorize(pecan.request.context, 'collector:manage_mapping', {})
try:
self._db.delete_mapping(service)

View File

@ -0,0 +1,5 @@
---
deprecations:
- |
Collector mappings have been deprecated and should not be used anymore. They
will be removed during OpenStack's S cycle.