Ghanshyam | d34326c | 2014-03-19 12:18:53 +0900 | [diff] [blame] | 1 | # Copyright 2014 NEC Corporation. All rights reserved. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
Ken'ichi Ohmichi | 024cdae | 2014-03-24 08:05:59 +0900 | [diff] [blame] | 15 | from tempest.api_schema.compute import parameter_types |
| 16 | |
Ghanshyam | 2b14d42 | 2014-03-24 10:46:33 +0900 | [diff] [blame^] | 17 | common_image_schema = { |
| 18 | 'type': 'object', |
| 19 | 'properties': { |
| 20 | 'id': {'type': 'string'}, |
| 21 | 'status': {'type': 'string'}, |
| 22 | 'updated': {'type': 'string'}, |
| 23 | 'links': parameter_types.links, |
| 24 | 'name': {'type': 'string'}, |
| 25 | 'created': {'type': 'string'}, |
| 26 | 'minDisk': {'type': 'integer'}, |
| 27 | 'minRam': {'type': 'integer'}, |
| 28 | 'progress': {'type': 'integer'}, |
| 29 | 'metadata': {'type': 'object'}, |
| 30 | 'server': { |
| 31 | 'type': 'object', |
| 32 | 'properties': { |
| 33 | # NOTE: Now the type of 'id' is integer, but here |
| 34 | # allows 'string' also because we will be able to |
| 35 | # change it to 'uuid' in the future. |
| 36 | 'id': {'type': ['integer', 'string']}, |
| 37 | 'links': parameter_types.links |
| 38 | }, |
| 39 | 'required': ['id', 'links'] |
| 40 | }, |
| 41 | 'OS-EXT-IMG-SIZE:size': {'type': 'integer'} |
| 42 | }, |
| 43 | # 'server' attributes only comes in response body if image is |
| 44 | # associated with any server. 'OS-EXT-IMG-SIZE:size' is API |
| 45 | # extension, So those are not defined as 'required'. |
| 46 | 'required': ['id', 'status', 'updated', 'links', 'name', |
| 47 | 'created', 'minDisk', 'minRam', 'progress', |
| 48 | 'metadata'] |
| 49 | } |
| 50 | |
Ghanshyam | d34326c | 2014-03-19 12:18:53 +0900 | [diff] [blame] | 51 | get_image = { |
| 52 | 'status_code': [200], |
| 53 | 'response_body': { |
| 54 | 'type': 'object', |
| 55 | 'properties': { |
Ghanshyam | 2b14d42 | 2014-03-24 10:46:33 +0900 | [diff] [blame^] | 56 | 'image': common_image_schema |
Ghanshyam | d34326c | 2014-03-19 12:18:53 +0900 | [diff] [blame] | 57 | }, |
| 58 | 'required': ['image'] |
| 59 | } |
| 60 | } |
Ghanshyam | fb67f06 | 2014-03-24 10:20:57 +0900 | [diff] [blame] | 61 | |
| 62 | list_images = { |
| 63 | 'status_code': [200], |
| 64 | 'response_body': { |
| 65 | 'type': 'object', |
| 66 | 'properties': { |
| 67 | 'images': { |
| 68 | 'type': 'array', |
| 69 | 'items': { |
| 70 | 'type': 'object', |
| 71 | 'properties': { |
| 72 | 'id': {'type': 'string'}, |
Ghanshyam | 2b14d42 | 2014-03-24 10:46:33 +0900 | [diff] [blame^] | 73 | 'links': parameter_types.links, |
Ghanshyam | fb67f06 | 2014-03-24 10:20:57 +0900 | [diff] [blame] | 74 | 'name': {'type': 'string'} |
| 75 | }, |
| 76 | 'required': ['id', 'links', 'name'] |
| 77 | } |
| 78 | } |
| 79 | }, |
| 80 | 'required': ['images'] |
| 81 | } |
| 82 | } |
Ghanshyam | fa9d39f | 2014-03-28 12:38:43 +0900 | [diff] [blame] | 83 | |
| 84 | create_image = { |
| 85 | 'status_code': [202] |
| 86 | } |
| 87 | |
| 88 | delete = { |
| 89 | 'status_code': [204] |
| 90 | } |
Ghanshyam | f7873b0 | 2014-03-28 12:50:57 +0900 | [diff] [blame] | 91 | |
| 92 | image_metadata = { |
| 93 | 'status_code': [200], |
| 94 | 'response_body': { |
| 95 | 'type': 'object', |
| 96 | 'properties': { |
| 97 | 'metadata': {'type': 'object'} |
| 98 | }, |
| 99 | 'required': ['metadata'] |
| 100 | } |
| 101 | } |
Ghanshyam | 76c00f0 | 2014-03-28 13:02:22 +0900 | [diff] [blame] | 102 | |
| 103 | image_meta_item = { |
| 104 | 'status_code': [200], |
| 105 | 'response_body': { |
| 106 | 'type': 'object', |
| 107 | 'properties': { |
| 108 | 'meta': {'type': 'object'} |
| 109 | }, |
| 110 | 'required': ['meta'] |
| 111 | } |
| 112 | } |
Ghanshyam | 2b14d42 | 2014-03-24 10:46:33 +0900 | [diff] [blame^] | 113 | |
| 114 | list_images_details = { |
| 115 | 'status_code': [200], |
| 116 | 'response_body': { |
| 117 | 'type': 'object', |
| 118 | 'properties': { |
| 119 | 'images': { |
| 120 | 'type': 'array', |
| 121 | 'items': common_image_schema |
| 122 | } |
| 123 | }, |
| 124 | 'required': ['images'] |
| 125 | } |
| 126 | } |