octavia.api.handlers.abstract_handler

Source code for octavia.api.handlers.abstract_handler

#    Copyright 2014 Rackspace
#
#    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 abc

import six


[docs]@six.add_metaclass(abc.ABCMeta) class BaseObjectHandler(object): """Base class for any object handler."""
[docs] @abc.abstractmethod def create(self, model_id): """Begins process of actually creating data_model.""" pass
[docs] @abc.abstractmethod def update(self, model_id, updated_dict): """Begins process of actually updating data_model.""" pass
[docs] @abc.abstractmethod def delete(self, model_id): """Begins process of actually deleting data_model.""" pass
[docs]class NotImplementedObjectHandler(BaseObjectHandler): """Default Object Handler to force implementation of subclasses. Helper class to make any subclass of AbstractHandler explode if it is missing any of the required object managers. """
[docs] @staticmethod def update(model_id, updated_dict): raise NotImplementedError()
[docs] @staticmethod def delete(model_id): raise NotImplementedError()
[docs] @staticmethod def create(model_id): raise NotImplementedError()
[docs]@six.add_metaclass(abc.ABCMeta) class BaseHandler(object): """Base class for all handlers.""" load_balancer = NotImplementedObjectHandler() listener = NotImplementedObjectHandler() pool = NotImplementedObjectHandler() health_monitor = NotImplementedObjectHandler() member = NotImplementedObjectHandler() l7policy = NotImplementedObjectHandler() l7rule = NotImplementedObjectHandler()
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.