Add OBJ_PROJECT_NAMESPACE for Heat project

This code will be used when objects are registered and serialized.

Change-Id: I9d9095bc40e61a104ebea5042f4eb75d16d27d69
Partial-Bug: 1491258
This commit is contained in:
Grzegorz Grasza 2015-09-09 15:24:30 +02:00 committed by Randall Burt
parent aa867937c1
commit dfdbc99d8f
16 changed files with 97 additions and 33 deletions

22
heat/objects/base.py Normal file
View File

@ -0,0 +1,22 @@
# Copyright 2015 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.
"""Heat common internal object model"""
from oslo_versionedobjects import base as ovoo_base
class HeatObject(ovoo_base.VersionedObject):
OBJ_PROJECT_NAMESPACE = 'heat'
VERSION = '1.0'

View File

@ -18,10 +18,14 @@ from oslo_versionedobjects import base
from oslo_versionedobjects import fields from oslo_versionedobjects import fields
from heat.db import api as db_api from heat.db 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 fields as heat_fields
class Event(base.VersionedObject, base.VersionedObjectDictCompat): class Event(
heat_base.HeatObject,
base.VersionedObjectDictCompat,
):
fields = { fields = {
'id': fields.IntegerField(), 'id': fields.IntegerField(),
'stack_id': fields.StringField(), 'stack_id': fields.StringField(),

View File

@ -24,11 +24,12 @@ from oslo_versionedobjects import fields
from heat.common import crypt from heat.common import crypt
from heat.common import environment_format as env_fmt from heat.common import environment_format as env_fmt
from heat.db import api as db_api from heat.db 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 fields as heat_fields
class RawTemplate( class RawTemplate(
base.VersionedObject, heat_base.HeatObject,
base.VersionedObjectDictCompat, base.VersionedObjectDictCompat,
base.ComparableVersionedObject, base.ComparableVersionedObject,
): ):

View File

@ -23,6 +23,7 @@ import six
from heat.common import crypt from heat.common import crypt
from heat.db import api as db_api from heat.db 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 fields as heat_fields
from heat.objects import resource_data from heat.objects import resource_data
from heat.objects import stack from heat.objects import stack
@ -31,7 +32,7 @@ cfg.CONF.import_opt('encrypt_parameters_and_properties', 'heat.common.config')
class Resource( class Resource(
base.VersionedObject, heat_base.HeatObject,
base.VersionedObjectDictCompat, base.VersionedObjectDictCompat,
base.ComparableVersionedObject, base.ComparableVersionedObject,
): ):

View File

@ -20,10 +20,11 @@ from oslo_versionedobjects import fields
from heat.common import exception from heat.common import exception
from heat.db import api as db_api from heat.db import api as db_api
from heat.objects import base as heat_base
class ResourceData( class ResourceData(
base.VersionedObject, heat_base.HeatObject,
base.VersionedObjectDictCompat, base.VersionedObjectDictCompat,
base.ComparableVersionedObject, base.ComparableVersionedObject,
): ):

View File

@ -18,11 +18,14 @@ from oslo_versionedobjects import base
from oslo_versionedobjects import fields from oslo_versionedobjects import fields
from heat.db import api as db_api from heat.db import api as db_api
from heat.objects import base as heat_base
class Service(base.VersionedObject, class Service(
base.VersionedObjectDictCompat, heat_base.HeatObject,
base.ComparableVersionedObject): base.VersionedObjectDictCompat,
base.ComparableVersionedObject,
):
fields = { fields = {
'id': fields.StringField(), 'id': fields.StringField(),
'engine_id': fields.StringField(), 'engine_id': fields.StringField(),

View File

@ -19,12 +19,15 @@ from oslo_versionedobjects import base
from oslo_versionedobjects import fields from oslo_versionedobjects import fields
from heat.db import api as db_api from heat.db 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 fields as heat_fields
class Snapshot(base.VersionedObject, class Snapshot(
base.VersionedObjectDictCompat, heat_base.HeatObject,
base.ComparableVersionedObject): base.VersionedObjectDictCompat,
base.ComparableVersionedObject,
):
fields = { fields = {
'id': fields.StringField(), 'id': fields.StringField(),

View File

@ -19,12 +19,15 @@ from oslo_versionedobjects import base
from oslo_versionedobjects import fields from oslo_versionedobjects import fields
from heat.db import api as db_api from heat.db 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 fields as heat_fields
class SoftwareConfig(base.VersionedObject, class SoftwareConfig(
base.VersionedObjectDictCompat, heat_base.HeatObject,
base.ComparableVersionedObject): base.VersionedObjectDictCompat,
base.ComparableVersionedObject,
):
fields = { fields = {
'id': fields.StringField(), 'id': fields.StringField(),
'name': fields.StringField(nullable=True), 'name': fields.StringField(nullable=True),

View File

@ -19,13 +19,16 @@ from oslo_versionedobjects import base
from oslo_versionedobjects import fields from oslo_versionedobjects import fields
from heat.db import api as db_api from heat.db 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 fields as heat_fields
from heat.objects import software_config from heat.objects import software_config
class SoftwareDeployment(base.VersionedObject, class SoftwareDeployment(
base.VersionedObjectDictCompat, heat_base.HeatObject,
base.ComparableVersionedObject): base.VersionedObjectDictCompat,
base.ComparableVersionedObject,
):
fields = { fields = {
'id': fields.StringField(), 'id': fields.StringField(),
'config_id': fields.StringField(), 'config_id': fields.StringField(),

View File

@ -23,13 +23,14 @@ from oslo_versionedobjects import fields
from heat.common import exception from heat.common import exception
from heat.common.i18n import _ from heat.common.i18n import _
from heat.db import api as db_api from heat.db 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 fields as heat_fields
from heat.objects import raw_template from heat.objects import raw_template
from heat.objects import stack_tag from heat.objects import stack_tag
class Stack( class Stack(
base.VersionedObject, heat_base.HeatObject,
base.VersionedObjectDictCompat, base.VersionedObjectDictCompat,
base.ComparableVersionedObject, base.ComparableVersionedObject,
): ):

View File

@ -18,11 +18,14 @@ from oslo_versionedobjects import base
from oslo_versionedobjects import fields from oslo_versionedobjects import fields
from heat.db import api as db_api from heat.db import api as db_api
from heat.objects import base as heat_base
class StackLock(base.VersionedObject, class StackLock(
base.VersionedObjectDictCompat, heat_base.HeatObject,
base.ComparableVersionedObject): base.VersionedObjectDictCompat,
base.ComparableVersionedObject,
):
fields = { fields = {
'engine_id': fields.StringField(nullable=True), 'engine_id': fields.StringField(nullable=True),
'stack_id': fields.StringField(), 'stack_id': fields.StringField(),

View File

@ -18,11 +18,14 @@ from oslo_versionedobjects import base
from oslo_versionedobjects import fields from oslo_versionedobjects import fields
from heat.db import api as db_api from heat.db import api as db_api
from heat.objects import base as heat_base
class StackTag(base.VersionedObject, class StackTag(
base.VersionedObjectDictCompat, heat_base.HeatObject,
base.ComparableVersionedObject): base.VersionedObjectDictCompat,
base.ComparableVersionedObject,
):
fields = { fields = {
'id': fields.IntegerField(), 'id': fields.IntegerField(),
'tag': fields.StringField(nullable=True), 'tag': fields.StringField(nullable=True),
@ -49,8 +52,10 @@ class StackTag(base.VersionedObject,
return cls._from_db_object(cls(context), tag) return cls._from_db_object(cls(context), tag)
class StackTagList(base.VersionedObject, class StackTagList(
base.ObjectListBase): heat_base.HeatObject,
base.ObjectListBase,
):
fields = { fields = {
'objects': fields.ListOfObjectsField('StackTag'), 'objects': fields.ListOfObjectsField('StackTag'),

View File

@ -19,12 +19,15 @@ from oslo_versionedobjects import base
from oslo_versionedobjects import fields from oslo_versionedobjects import fields
from heat.db import api as db_api from heat.db 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 fields as heat_fields
class SyncPoint(base.VersionedObject, class SyncPoint(
base.VersionedObjectDictCompat, heat_base.HeatObject,
base.ComparableVersionedObject): base.VersionedObjectDictCompat,
base.ComparableVersionedObject,
):
fields = { fields = {
'entity_id': fields.StringField(), 'entity_id': fields.StringField(),

View File

@ -19,12 +19,15 @@ from oslo_versionedobjects import base
from oslo_versionedobjects import fields from oslo_versionedobjects import fields
from heat.db import api as db_api from heat.db import api as db_api
from heat.objects import base as heat_base
@base.VersionedObjectRegistry.register @base.VersionedObjectRegistry.register
class UserCreds(base.VersionedObject, class UserCreds(
base.VersionedObjectDictCompat, heat_base.HeatObject,
base.ComparableVersionedObject): base.VersionedObjectDictCompat,
base.ComparableVersionedObject,
):
fields = { fields = {
'id': fields.StringField(), 'id': fields.StringField(),
'created_at': fields.DateTimeField(read_only=True), 'created_at': fields.DateTimeField(read_only=True),

View File

@ -18,10 +18,14 @@ from oslo_versionedobjects import base
from oslo_versionedobjects import fields from oslo_versionedobjects import fields
from heat.db import api as db_api from heat.db 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 fields as heat_fields
class WatchData(base.VersionedObject, base.VersionedObjectDictCompat): class WatchData(
heat_base.HeatObject,
base.VersionedObjectDictCompat,
):
fields = { fields = {
'id': fields.IntegerField(), 'id': fields.IntegerField(),

View File

@ -18,12 +18,16 @@ from oslo_versionedobjects import base
from oslo_versionedobjects import fields from oslo_versionedobjects import fields
from heat.db import api as db_api from heat.db 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 fields as heat_fields
from heat.objects import stack from heat.objects import stack
from heat.objects import watch_data from heat.objects import watch_data
class WatchRule(base.VersionedObject, base.VersionedObjectDictCompat): class WatchRule(
heat_base.HeatObject,
base.VersionedObjectDictCompat,
):
fields = { fields = {
'id': fields.IntegerField(), 'id': fields.IntegerField(),