summaryrefslogtreecommitdiff
path: root/heat/objects
diff options
context:
space:
mode:
authorrabi <ramishra@redhat.com>2017-10-27 12:57:24 +0530
committerrabi <ramishra@redhat.com>2018-01-28 09:35:05 +0530
commit8db1b3ea411b60914f4272dbbb37195b793b6031 (patch)
tree541183fe6a269073061095cdbc761361bf513b51 /heat/objects
parent5bd856627ae77c29e96de2200c68e5822753b689 (diff)
downloadheat-8db1b3ea411b60914f4272dbbb37195b793b6031.tar.gz
Remove stack watch service
This removes the rpc api and related code. Change-Id: Ib89bcc3ff6a542f49467e2ad6c7e2a716a0dc2b4 Partial-Bug: #1743707
Diffstat (limited to 'heat/objects')
-rw-r--r--heat/objects/watch_data.py60
-rw-r--r--heat/objects/watch_rule.py87
2 files changed, 0 insertions, 147 deletions
diff --git a/heat/objects/watch_data.py b/heat/objects/watch_data.py
deleted file mode 100644
index e972f337f..000000000
--- a/heat/objects/watch_data.py
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright 2014 Intel Corp.
-#
-# 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.
-
-"""WatchData object."""
-
-from oslo_versionedobjects import base
-from oslo_versionedobjects import fields
-
-from heat.db.sqlalchemy import api as db_api
-from heat.objects import base as heat_base
-from heat.objects import fields as heat_fields
-
-
-class WatchData(
- heat_base.HeatObject,
- base.VersionedObjectDictCompat,
-):
-
- fields = {
- 'id': fields.IntegerField(),
- 'data': heat_fields.JsonField(nullable=True),
- 'watch_rule_id': fields.StringField(),
- 'created_at': fields.DateTimeField(read_only=True),
- 'updated_at': fields.DateTimeField(nullable=True),
- }
-
- @staticmethod
- def _from_db_object(context, rule, db_data):
- for field in rule.fields:
- rule[field] = db_data[field]
- rule._context = context
- rule.obj_reset_changes()
- return rule
-
- @classmethod
- def create(cls, context, values):
- db_data = db_api.watch_data_create(context, values)
- return cls._from_db_object(context, cls(), db_data)
-
- @classmethod
- def get_all(cls, context):
- return [cls._from_db_object(context, cls(), db_data)
- for db_data in db_api.watch_data_get_all(context)]
-
- @classmethod
- def get_all_by_watch_rule_id(cls, context, watch_rule_id):
- return (cls._from_db_object(context, cls(), db_data)
- for db_data in db_api.watch_data_get_all_by_watch_rule_id(
- context, watch_rule_id))
diff --git a/heat/objects/watch_rule.py b/heat/objects/watch_rule.py
deleted file mode 100644
index 36ff0c27d..000000000
--- a/heat/objects/watch_rule.py
+++ /dev/null
@@ -1,87 +0,0 @@
-# Copyright 2014 Intel Corp.
-#
-# 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.
-
-"""WatchRule object."""
-
-from oslo_versionedobjects import base
-from oslo_versionedobjects import fields
-
-from heat.db.sqlalchemy import api as db_api
-from heat.objects import base as heat_base
-from heat.objects import fields as heat_fields
-from heat.objects import watch_data
-
-
-class WatchRule(
- heat_base.HeatObject,
- base.VersionedObjectDictCompat,
-):
-
- fields = {
- 'id': fields.IntegerField(),
- 'name': fields.StringField(nullable=True),
- 'rule': heat_fields.JsonField(nullable=True),
- 'state': fields.StringField(nullable=True),
- 'last_evaluated': fields.DateTimeField(nullable=True),
- 'stack_id': fields.StringField(),
- 'watch_data': fields.ListOfObjectsField(watch_data.WatchData),
- 'created_at': fields.DateTimeField(read_only=True),
- 'updated_at': fields.DateTimeField(nullable=True),
- }
-
- @staticmethod
- def _from_db_object(context, rule, db_rule):
- for field in rule.fields:
- if field == 'watch_data':
- rule[field] = watch_data.WatchData.get_all_by_watch_rule_id(
- context, db_rule['id'])
- else:
- rule[field] = db_rule[field]
- rule._context = context
- rule.obj_reset_changes()
- return rule
-
- @classmethod
- def get_by_id(cls, context, rule_id):
- db_rule = db_api.watch_rule_get(context, rule_id)
- return cls._from_db_object(context, cls(), db_rule)
-
- @classmethod
- def get_by_name(cls, context, watch_rule_name):
- db_rule = db_api.watch_rule_get_by_name(context, watch_rule_name)
- return cls._from_db_object(context, cls(), db_rule)
-
- @classmethod
- def get_all(cls, context):
- return [cls._from_db_object(context, cls(), db_rule)
- for db_rule in db_api.watch_rule_get_all(context)]
-
- @classmethod
- def get_all_by_stack(cls, context, stack_id):
- return [cls._from_db_object(context, cls(), db_rule)
- for db_rule in db_api.watch_rule_get_all_by_stack(context,
- stack_id)]
-
- @classmethod
- def update_by_id(cls, context, watch_id, values):
- db_api.watch_rule_update(context, watch_id, values)
-
- @classmethod
- def create(cls, context, values):
- return cls._from_db_object(context, cls(),
- db_api.watch_rule_create(context, values))
-
- @classmethod
- def delete(cls, context, watch_id):
- db_api.watch_rule_delete(context, watch_id)