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 | |
Marc Koderer | 6fbd74f | 2014-08-04 09:38:19 +0200 | [diff] [blame] | 15 | from tempest.api_schema.response.compute import parameter_types |
Ken'ichi Ohmichi | 024cdae | 2014-03-24 08:05:59 +0900 | [diff] [blame] | 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': { |
Ghanshyam | c5b842d | 2014-06-10 17:06:05 +0900 | [diff] [blame] | 33 | 'id': {'type': 'string'}, |
Ghanshyam | 2b14d42 | 2014-03-24 10:46:33 +0900 | [diff] [blame] | 34 | 'links': parameter_types.links |
| 35 | }, |
| 36 | 'required': ['id', 'links'] |
| 37 | }, |
| 38 | 'OS-EXT-IMG-SIZE:size': {'type': 'integer'} |
| 39 | }, |
| 40 | # 'server' attributes only comes in response body if image is |
| 41 | # associated with any server. 'OS-EXT-IMG-SIZE:size' is API |
| 42 | # extension, So those are not defined as 'required'. |
| 43 | 'required': ['id', 'status', 'updated', 'links', 'name', |
| 44 | 'created', 'minDisk', 'minRam', 'progress', |
| 45 | 'metadata'] |
| 46 | } |
| 47 | |
Ghanshyam | d34326c | 2014-03-19 12:18:53 +0900 | [diff] [blame] | 48 | get_image = { |
| 49 | 'status_code': [200], |
| 50 | 'response_body': { |
| 51 | 'type': 'object', |
| 52 | 'properties': { |
Ghanshyam | 2b14d42 | 2014-03-24 10:46:33 +0900 | [diff] [blame] | 53 | 'image': common_image_schema |
Ghanshyam | d34326c | 2014-03-19 12:18:53 +0900 | [diff] [blame] | 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'}, |
Ghanshyam | 2b14d42 | 2014-03-24 10:46:33 +0900 | [diff] [blame] | 70 | 'links': parameter_types.links, |
Ghanshyam | fb67f06 | 2014-03-24 10:20:57 +0900 | [diff] [blame] | 71 | 'name': {'type': 'string'} |
| 72 | }, |
| 73 | 'required': ['id', 'links', 'name'] |
| 74 | } |
| 75 | } |
| 76 | }, |
| 77 | 'required': ['images'] |
| 78 | } |
| 79 | } |
Ghanshyam | fa9d39f | 2014-03-28 12:38:43 +0900 | [diff] [blame] | 80 | |
| 81 | create_image = { |
Ken'ichi Ohmichi | 57b384b | 2014-03-28 13:58:20 +0900 | [diff] [blame] | 82 | 'status_code': [202], |
| 83 | 'response_header': { |
| 84 | 'type': 'object', |
| 85 | 'properties': { |
| 86 | 'location': { |
| 87 | 'type': 'string', |
| 88 | 'format': 'uri' |
| 89 | } |
| 90 | }, |
| 91 | 'required': ['location'] |
| 92 | } |
Ghanshyam | fa9d39f | 2014-03-28 12:38:43 +0900 | [diff] [blame] | 93 | } |
| 94 | |
| 95 | delete = { |
| 96 | 'status_code': [204] |
| 97 | } |
Ghanshyam | f7873b0 | 2014-03-28 12:50:57 +0900 | [diff] [blame] | 98 | |
| 99 | image_metadata = { |
| 100 | 'status_code': [200], |
| 101 | 'response_body': { |
| 102 | 'type': 'object', |
| 103 | 'properties': { |
| 104 | 'metadata': {'type': 'object'} |
| 105 | }, |
| 106 | 'required': ['metadata'] |
| 107 | } |
| 108 | } |
Ghanshyam | 76c00f0 | 2014-03-28 13:02:22 +0900 | [diff] [blame] | 109 | |
| 110 | image_meta_item = { |
| 111 | 'status_code': [200], |
| 112 | 'response_body': { |
| 113 | 'type': 'object', |
| 114 | 'properties': { |
| 115 | 'meta': {'type': 'object'} |
| 116 | }, |
| 117 | 'required': ['meta'] |
| 118 | } |
| 119 | } |
Ghanshyam | 2b14d42 | 2014-03-24 10:46:33 +0900 | [diff] [blame] | 120 | |
| 121 | list_images_details = { |
| 122 | 'status_code': [200], |
| 123 | 'response_body': { |
| 124 | 'type': 'object', |
| 125 | 'properties': { |
| 126 | 'images': { |
| 127 | 'type': 'array', |
| 128 | 'items': common_image_schema |
| 129 | } |
| 130 | }, |
| 131 | 'required': ['images'] |
| 132 | } |
| 133 | } |