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 | d34326c | 2014-03-19 12:18:53 +0900 | [diff] [blame] | 17 | get_image = { |
| 18 | 'status_code': [200], |
| 19 | 'response_body': { |
| 20 | 'type': 'object', |
| 21 | 'properties': { |
| 22 | 'image': { |
| 23 | 'type': 'object', |
| 24 | 'properties': { |
| 25 | 'id': {'type': 'string'}, |
| 26 | 'status': {'type': 'string'}, |
| 27 | 'updated': {'type': 'string'}, |
Ken'ichi Ohmichi | 024cdae | 2014-03-24 08:05:59 +0900 | [diff] [blame] | 28 | 'links': parameter_types.links, |
Ghanshyam | d34326c | 2014-03-19 12:18:53 +0900 | [diff] [blame] | 29 | 'name': {'type': 'string'}, |
| 30 | 'created': {'type': 'string'}, |
| 31 | 'OS-EXT-IMG-SIZE:size': {'type': 'integer'}, |
| 32 | 'minDisk': {'type': 'integer'}, |
| 33 | 'minRam': {'type': 'integer'}, |
| 34 | 'progress': {'type': 'integer'}, |
| 35 | 'metadata': {'type': 'object'}, |
| 36 | 'server': { |
| 37 | 'type': 'object', |
| 38 | 'properties': { |
| 39 | # NOTE: Now the type of 'id' is integer, but here |
| 40 | # allows 'string' also because we will be able to |
| 41 | # change it to 'uuid' in the future. |
| 42 | 'id': {'type': ['integer', 'string']}, |
Ken'ichi Ohmichi | 024cdae | 2014-03-24 08:05:59 +0900 | [diff] [blame] | 43 | 'links': parameter_types.links |
Ghanshyam | d34326c | 2014-03-19 12:18:53 +0900 | [diff] [blame] | 44 | }, |
| 45 | 'required': ['id', 'links'] |
| 46 | } |
| 47 | }, |
| 48 | # 'server' attributes only comes in response body if image is |
| 49 | # associated with any server. So it is not 'required' |
| 50 | 'required': ['id', 'status', 'updated', 'links', 'name', |
| 51 | 'created', 'OS-EXT-IMG-SIZE:size', 'minDisk', |
| 52 | 'minRam', 'progress', 'metadata'] |
| 53 | } |
| 54 | }, |
| 55 | 'required': ['image'] |
| 56 | } |
| 57 | } |
Ghanshyam | fb67f06 | 2014-03-24 10:20:57 +0900 | [diff] [blame] | 58 | |
| 59 | list_images = { |
| 60 | 'status_code': [200], |
| 61 | 'response_body': { |
| 62 | 'type': 'object', |
| 63 | 'properties': { |
| 64 | 'images': { |
| 65 | 'type': 'array', |
| 66 | 'items': { |
| 67 | 'type': 'object', |
| 68 | 'properties': { |
| 69 | 'id': {'type': 'string'}, |
| 70 | 'links': { |
| 71 | 'type': 'array', |
| 72 | 'items': { |
| 73 | 'type': 'object', |
| 74 | 'properties': { |
| 75 | 'href': { |
| 76 | 'type': 'string', |
| 77 | 'format': 'uri' |
| 78 | }, |
| 79 | 'rel': {'type': 'string'} |
| 80 | }, |
| 81 | 'required': ['href', 'rel'] |
| 82 | } |
| 83 | }, |
| 84 | 'name': {'type': 'string'} |
| 85 | }, |
| 86 | 'required': ['id', 'links', 'name'] |
| 87 | } |
| 88 | } |
| 89 | }, |
| 90 | 'required': ['images'] |
| 91 | } |
| 92 | } |
Ghanshyam | fa9d39f | 2014-03-28 12:38:43 +0900 | [diff] [blame] | 93 | |
| 94 | create_image = { |
| 95 | 'status_code': [202] |
| 96 | } |
| 97 | |
| 98 | delete = { |
| 99 | 'status_code': [204] |
| 100 | } |
Ghanshyam | f7873b0 | 2014-03-28 12:50:57 +0900 | [diff] [blame^] | 101 | |
| 102 | image_metadata = { |
| 103 | 'status_code': [200], |
| 104 | 'response_body': { |
| 105 | 'type': 'object', |
| 106 | 'properties': { |
| 107 | 'metadata': {'type': 'object'} |
| 108 | }, |
| 109 | 'required': ['metadata'] |
| 110 | } |
| 111 | } |