Merge "Add attribute type for openstack resources"

This commit is contained in:
Jenkins 2015-06-19 10:03:25 +00:00 committed by Gerrit Code Review
commit 2cc97650c5
7 changed files with 58 additions and 28 deletions

View File

@ -141,46 +141,60 @@ class CinderVolume(vb.BaseVolume):
attributes_schema = { attributes_schema = {
AVAILABILITY_ZONE_ATTR: attributes.Schema( AVAILABILITY_ZONE_ATTR: attributes.Schema(
_('The availability zone in which the volume is located.') _('The availability zone in which the volume is located.'),
type=attributes.Schema.STRING
), ),
SIZE_ATTR: attributes.Schema( SIZE_ATTR: attributes.Schema(
_('The size of the volume in GB.') _('The size of the volume in GB.'),
type=attributes.Schema.STRING
), ),
SNAPSHOT_ID_ATTR: attributes.Schema( SNAPSHOT_ID_ATTR: attributes.Schema(
_('The snapshot the volume was created from, if any.') _('The snapshot the volume was created from, if any.'),
type=attributes.Schema.STRING
), ),
DISPLAY_NAME_ATTR: attributes.Schema( DISPLAY_NAME_ATTR: attributes.Schema(
_('Name of the volume.') _('Name of the volume.'),
type=attributes.Schema.STRING
), ),
DISPLAY_DESCRIPTION_ATTR: attributes.Schema( DISPLAY_DESCRIPTION_ATTR: attributes.Schema(
_('Description of the volume.') _('Description of the volume.'),
type=attributes.Schema.STRING
), ),
VOLUME_TYPE_ATTR: attributes.Schema( VOLUME_TYPE_ATTR: attributes.Schema(
_('The type of the volume mapping to a backend, if any.') _('The type of the volume mapping to a backend, if any.'),
type=attributes.Schema.STRING
), ),
METADATA_ATTR: attributes.Schema( METADATA_ATTR: attributes.Schema(
_('Key/value pairs associated with the volume.') _('Key/value pairs associated with the volume.'),
type=attributes.Schema.STRING
), ),
SOURCE_VOLID_ATTR: attributes.Schema( SOURCE_VOLID_ATTR: attributes.Schema(
_('The volume used as source, if any.') _('The volume used as source, if any.'),
type=attributes.Schema.STRING
), ),
STATUS: attributes.Schema( STATUS: attributes.Schema(
_('The current status of the volume.') _('The current status of the volume.'),
type=attributes.Schema.STRING
), ),
CREATED_AT: attributes.Schema( CREATED_AT: attributes.Schema(
_('The timestamp indicating volume creation.') _('The timestamp indicating volume creation.'),
type=attributes.Schema.STRING
), ),
BOOTABLE: attributes.Schema( BOOTABLE: attributes.Schema(
_('Boolean indicating if the volume can be booted or not.') _('Boolean indicating if the volume can be booted or not.'),
type=attributes.Schema.STRING
), ),
METADATA_VALUES_ATTR: attributes.Schema( METADATA_VALUES_ATTR: attributes.Schema(
_('Key/value pairs associated with the volume in raw dict form.') _('Key/value pairs associated with the volume in raw dict form.'),
type=attributes.Schema.MAP
), ),
ENCRYPTED_ATTR: attributes.Schema( ENCRYPTED_ATTR: attributes.Schema(
_('Boolean indicating if the volume is encrypted or not.') _('Boolean indicating if the volume is encrypted or not.'),
type=attributes.Schema.STRING
), ),
ATTACHMENTS: attributes.Schema( ATTACHMENTS: attributes.Schema(
_('The list of attachments of the volume.') _('The list of attachments of the volume.'),
type=attributes.Schema.STRING
), ),
} }

View File

@ -47,10 +47,12 @@ class NovaFloatingIp(resource.Resource):
attributes_schema = { attributes_schema = {
POOL_ATTR: attributes.Schema( POOL_ATTR: attributes.Schema(
_('Pool from which floating IP is allocated.') _('Pool from which floating IP is allocated.'),
type=attributes.Schema.STRING
), ),
IP: attributes.Schema( IP: attributes.Schema(
_('Allocated floating IP address.') _('Allocated floating IP address.'),
type=attributes.Schema.STRING
), ),
} }

View File

@ -73,11 +73,13 @@ class KeyPair(resource.Resource):
attributes_schema = { attributes_schema = {
PUBLIC_KEY_ATTR: attributes.Schema( PUBLIC_KEY_ATTR: attributes.Schema(
_('The public key.') _('The public key.'),
type=attributes.Schema.STRING
), ),
PRIVATE_KEY_ATTR: attributes.Schema( PRIVATE_KEY_ATTR: attributes.Schema(
_('The private key if it has been saved.'), _('The private key if it has been saved.'),
cache_mode=attributes.Schema.CACHE_NONE cache_mode=attributes.Schema.CACHE_NONE,
type=attributes.Schema.STRING
), ),
} }

View File

@ -107,9 +107,11 @@ class SaharaCluster(resource.Resource):
attributes_schema = { attributes_schema = {
STATUS: attributes.Schema( STATUS: attributes.Schema(
_("Cluster status."), _("Cluster status."),
type=attributes.Schema.STRING
), ),
INFO: attributes.Schema( INFO: attributes.Schema(
_("Cluster information."), _("Cluster information."),
type=attributes.Schema.MAP
), ),
} }

View File

@ -87,22 +87,28 @@ class SwiftContainer(resource.Resource):
attributes_schema = { attributes_schema = {
DOMAIN_NAME: attributes.Schema( DOMAIN_NAME: attributes.Schema(
_('The host from the container URL.') _('The host from the container URL.'),
type=attributes.Schema.STRING
), ),
WEBSITE_URL: attributes.Schema( WEBSITE_URL: attributes.Schema(
_('The URL of the container.') _('The URL of the container.'),
type=attributes.Schema.STRING
), ),
ROOT_URL: attributes.Schema( ROOT_URL: attributes.Schema(
_('The parent URL of the container.') _('The parent URL of the container.'),
type=attributes.Schema.STRING
), ),
OBJECT_COUNT: attributes.Schema( OBJECT_COUNT: attributes.Schema(
_('The number of objects stored in the container.') _('The number of objects stored in the container.'),
type=attributes.Schema.INTEGER
), ),
BYTES_USED: attributes.Schema( BYTES_USED: attributes.Schema(
_('The number of bytes stored in the container.') _('The number of bytes stored in the container.'),
type=attributes.Schema.INTEGER
), ),
HEAD_CONTAINER: attributes.Schema( HEAD_CONTAINER: attributes.Schema(
_('A map containing all headers for the container.') _('A map containing all headers for the container.'),
type=attributes.Schema.MAP
), ),
} }

View File

@ -265,10 +265,12 @@ class OSDBInstance(resource.Resource):
attributes_schema = { attributes_schema = {
HOSTNAME: attributes.Schema( HOSTNAME: attributes.Schema(
_("Hostname of the instance.") _("Hostname of the instance."),
type=attributes.Schema.STRING
), ),
HREF: attributes.Schema( HREF: attributes.Schema(
_("Api endpoint reference of the instance.") _("Api endpoint reference of the instance."),
type=attributes.Schema.STRING
), ),
} }

View File

@ -120,10 +120,12 @@ class TroveCluster(resource.Resource):
attributes_schema = { attributes_schema = {
INSTANCES: attributes.Schema( INSTANCES: attributes.Schema(
_("A list of instances ids.") _("A list of instances ids."),
type=attributes.Schema.LIST
), ),
IP: attributes.Schema( IP: attributes.Schema(
_("IP of the cluster.") _("IP of the cluster."),
type=attributes.Schema.LIST
) )
} }