NodeGroup creation request body schema validation

Change-Id: Iaba81fc52d285a36ef3fa7b8204293872227e7ad
This commit is contained in:
Sergey Lukjanov 2013-06-26 19:00:22 +04:00
parent d812f68e7a
commit 37e414cb82
2 changed files with 64 additions and 0 deletions

View File

@ -17,6 +17,7 @@ from savanna.openstack.common import log as logging
from savanna.service import api
from savanna.service import validation as v
from savanna.service.validations import images as v_images
from savanna.service.validations import node_group_templates as v_ngt
import savanna.utils.api as u
LOG = logging.getLogger(__name__)
@ -97,6 +98,7 @@ def node_group_templates_list():
@rest.post('/node-group-templates')
@v.validate(v_ngt.node_group_template_schema)
def node_group_templates_create(data):
return u.render(api.create_node_group_template(data).wrapped_dict)

View File

@ -12,3 +12,65 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
node_group_template_schema = {
"type": "object",
"properties": {
"name": {
"type": "string",
},
"tenant_id": {
"type": "string",
"format": "uuid",
},
"flavor_id": {
"type": "string",
"format": "uuid",
},
"plugin_name": {
"type": "string",
},
"hadoop_version": {
"type": "string",
},
"node_processes": {
"type": "array",
"items": {
"type": "string",
}
},
"image_id": {
"type": "string",
"format": "uuid",
},
"node_configs": {
"type": "configs",
},
"anti-affinity-group": {
"type": "string",
},
"volumes_per_node": {
"type": "integer",
"minimum": 0,
},
"volumes_size": {
"type": "integer",
"minimum": 0,
},
"volumes_mount_prefix": {
"type": "string",
},
"description": {
"type": "string",
},
},
"additionalProperties": False,
"required": [
"name",
"tenant_id",
"flavor_id",
"plugin_name",
"hadoop_version",
"node_processes",
]
}