Merge "Migrate object to OVO (2)"

This commit is contained in:
Zuul 2018-02-25 17:45:45 +00:00 committed by Gerrit Code Review
commit 31f283e89d
5 changed files with 76 additions and 165 deletions

View File

@ -19,6 +19,7 @@ import abc
from oslo_config import cfg
from oslo_log import log as logging
import six
from designate.i18n import _LW
from designate.plugin import DriverPlugin
@ -159,8 +160,9 @@ class Audit(NotificationPlugin):
new_value = getattr(arg, change)
# Just in case something odd makes it here
if any(type(val) not in
(int, float, bool, str, type(None))
if any(not isinstance(val,
(int, float, bool,
six.string_types, type(None)))
for val in (old_value, new_value)):
old_value, new_value = None, None
msg = _LW("Nulling notification values after "

View File

@ -13,56 +13,33 @@
# 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 designate.objects import base
from designate.objects import ovo_base as base
from designate.objects import fields
@base.DesignateRegistry.register
class ZoneExport(base.DictObjectMixin, base.PersistentObjectMixin,
base.DesignateObject):
FIELDS = {
'status': {
'schema': {
"type": "string",
"enum": ["ACTIVE", "PENDING", "DELETED", "ERROR", "COMPLETE"],
},
'read_only': True
},
'task_type': {
'schema': {
"type": "string",
"enum": ["EXPORT"],
},
'read_only': True
},
'tenant_id': {
'schema': {
'type': 'string',
},
'read_only': True
},
'location': {
'schema': {
'type': ['string', 'null'],
'maxLength': 160
},
'read_only': True
},
'message': {
'schema': {
'type': ['string', 'null'],
'maxLength': 160
},
'read_only': True
},
'zone_id': {
'schema': {
"type": "string",
"format": "uuid"
},
'read_only': True
},
fields = {
'status': fields.EnumField(
valid_values=["ACTIVE", "PENDING",
"DELETED", "ERROR", "COMPLETE"]
),
'task_type': fields.EnumField(
valid_values=["EXPORT"]
),
'tenant_id': fields.StringFields(nullable=True),
'location': fields.StringFields(nullable=True),
'message': fields.StringFields(nullable=True, maxLength=160),
'zone_id': fields.UUIDFields(nullable=True)
}
@base.DesignateRegistry.register
class ZoneExportList(base.ListObjectMixin, base.DesignateObject,
base.PagedListObjectMixin):
LIST_ITEM_TYPE = ZoneExport
fields = {
'objects': fields.ListOfObjectsField('ZoneExport'),
}

View File

@ -13,49 +13,32 @@
# 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 designate.objects import base
from designate.objects import ovo_base as base
from designate.objects import fields
@base.DesignateRegistry.register
class ZoneImport(base.DictObjectMixin, base.PersistentObjectMixin,
base.DesignateObject):
FIELDS = {
'status': {
'schema': {
"type": "string",
"enum": ["ACTIVE", "PENDING", "DELETED", "ERROR", "COMPLETE"],
},
'read_only': True
},
'task_type': {
'schema': {
"type": "string",
"enum": ["IMPORT"],
},
'read_only': True
},
'tenant_id': {
'schema': {
'type': 'string',
},
'read_only': True
},
'message': {
'schema': {
'type': ['string', 'null'],
'maxLength': 160
},
'read_only': True
},
'zone_id': {
'schema': {
"type": "string",
"format": "uuid"
},
'read_only': True
},
fields = {
'status': fields.EnumField(
valid_values=["ACTIVE", "PENDING",
"DELETED", "ERROR", "COMPLETE"]
),
'task_type': fields.EnumField(
valid_values=["IMPORT"]
),
'tenant_id': fields.StringFields(nullable=True),
'message': fields.StringFields(nullable=True, maxLength=160),
'zone_id': fields.UUIDFields(nullable=True)
}
@base.DesignateRegistry.register
class ZoneImportList(base.ListObjectMixin, base.DesignateObject,
base.PagedListObjectMixin):
LIST_ITEM_TYPE = ZoneImport
fields = {
'objects': fields.ListOfObjectsField('ZoneImport'),
}

View File

@ -13,46 +13,21 @@
# 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 designate.objects import base
from designate.objects import ovo_base as base
from designate.objects import fields
@base.DesignateRegistry.register
class ZoneTransferAccept(base.DictObjectMixin, base.PersistentObjectMixin,
base.DesignateObject):
FIELDS = {
'zone_transfer_request_id': {
'schema': {
"type": "string",
"format": "uuid"
},
"immutable": True
},
'tenant_id': {
'schema': {
'type': 'string',
},
'read_only': True
},
'status': {
'schema': {
"type": "string",
"enum": ["ACTIVE", "PENDING", "DELETED", "ERROR", "COMPLETE"],
},
'read_only': True
},
'key': {
'schema': {
"type": "string",
"maxLength": 160
},
'required': True
},
'zone_id': {
'schema': {
"type": "string",
"format": "uuid"
},
"immutable": True
},
fields = {
'zone_transfer_request_id': fields.UUIDFields(nullable=True),
'tenant_id': fields.StringFields(nullable=True),
'status': fields.EnumField(nullable=True, valid_values=[
"ACTIVE", "PENDING", "DELETED", "ERROR", "COMPLETE"
]),
'key': fields.StringFields(maxLength=160),
'zone_id': fields.UUIDFields(nullable=True),
}
STRING_KEYS = [
@ -60,6 +35,11 @@ class ZoneTransferAccept(base.DictObjectMixin, base.PersistentObjectMixin,
]
@base.DesignateRegistry.register
class ZoneTransferAcceptList(base.ListObjectMixin, base.DesignateObject,
base.PagedListObjectMixin):
LIST_ITEM_TYPE = ZoneTransferAccept
fields = {
'objects': fields.ListOfObjectsField('ZoneTransferAccept'),
}

View File

@ -13,57 +13,22 @@
# 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 designate.objects import base
from designate.objects import ovo_base as base
from designate.objects import fields
@base.DesignateRegistry.register
class ZoneTransferRequest(base.DictObjectMixin, base.PersistentObjectMixin,
base.DesignateObject,):
FIELDS = {
'key': {
'schema': {
"type": "string",
"maxLength": 160
},
},
'zone_id': {
'schema': {
"type": "string",
"description": "Zone identifier",
"format": "uuid"
},
"immutable": True
},
'description': {
'schema': {
"type": ["string", "null"],
"maxLength": 160
}
},
'tenant_id': {
'schema': {
'type': 'string',
},
'read_only': True
},
'target_tenant_id': {
'schema': {
'type': ['string', 'null'],
},
'immutable': True
},
'status': {
'schema': {
"type": "string",
"enum": ["ACTIVE", "PENDING", "DELETED", "ERROR", "COMPLETE"],
}
},
'zone_name': {
'schema': {
"type": ["string", "null"],
"maxLength": 255,
},
'read_only': True
},
base.DesignateObject, ):
fields = {
'key': fields.StringFields(nullable=True, maxLength=160),
'zone_id': fields.UUIDFields(nullable=True),
'description': fields.StringFields(nullable=True, maxLength=160),
'tenant_id': fields.StringFields(nullable=True),
'target_tenant_id': fields.StringFields(nullable=True),
'status': fields.EnumField(nullable=True, valid_values=[
"ACTIVE", "PENDING", "DELETED", "ERROR", "COMPLETE"]),
'zone_name': fields.StringFields(nullable=True, maxLength=255),
}
STRING_KEYS = [
@ -71,5 +36,9 @@ class ZoneTransferRequest(base.DictObjectMixin, base.PersistentObjectMixin,
]
@base.DesignateRegistry.register
class ZoneTransferRequestList(base.ListObjectMixin, base.DesignateObject):
LIST_ITEM_TYPE = ZoneTransferRequest
fields = {
'objects': fields.ListOfObjectsField('ZoneTransferRequest'),
}