Ash Wilson | 6f3162a | 2014-10-20 17:28:36 -0400 | [diff] [blame] | 1 | // +build fixtures |
Alex Gaynor | 2f07174 | 2014-11-13 12:03:29 -0800 | [diff] [blame^] | 2 | |
Ash Wilson | 6f3162a | 2014-10-20 17:28:36 -0400 | [diff] [blame] | 3 | package flavors |
| 4 | |
| 5 | import ( |
| 6 | os "github.com/rackspace/gophercloud/openstack/compute/v2/flavors" |
| 7 | ) |
| 8 | |
| 9 | // ListOutput is a sample response of a flavor List request. |
| 10 | const ListOutput = ` |
| 11 | { |
| 12 | "flavors": [ |
| 13 | { |
| 14 | "OS-FLV-EXT-DATA:ephemeral": 0, |
| 15 | "OS-FLV-WITH-EXT-SPECS:extra_specs": { |
| 16 | "class": "performance1", |
| 17 | "disk_io_index": "40", |
| 18 | "number_of_data_disks": "0", |
| 19 | "policy_class": "performance_flavor", |
| 20 | "resize_policy_class": "performance_flavor" |
| 21 | }, |
| 22 | "disk": 20, |
| 23 | "id": "performance1-1", |
| 24 | "links": [ |
| 25 | { |
| 26 | "href": "https://iad.servers.api.rackspacecloud.com/v2/864477/flavors/performance1-1", |
| 27 | "rel": "self" |
| 28 | }, |
| 29 | { |
| 30 | "href": "https://iad.servers.api.rackspacecloud.com/864477/flavors/performance1-1", |
| 31 | "rel": "bookmark" |
| 32 | } |
| 33 | ], |
| 34 | "name": "1 GB Performance", |
| 35 | "ram": 1024, |
| 36 | "rxtx_factor": 200, |
| 37 | "swap": "", |
| 38 | "vcpus": 1 |
| 39 | }, |
| 40 | { |
| 41 | "OS-FLV-EXT-DATA:ephemeral": 20, |
| 42 | "OS-FLV-WITH-EXT-SPECS:extra_specs": { |
| 43 | "class": "performance1", |
| 44 | "disk_io_index": "40", |
| 45 | "number_of_data_disks": "1", |
| 46 | "policy_class": "performance_flavor", |
| 47 | "resize_policy_class": "performance_flavor" |
| 48 | }, |
| 49 | "disk": 40, |
| 50 | "id": "performance1-2", |
| 51 | "links": [ |
| 52 | { |
| 53 | "href": "https://iad.servers.api.rackspacecloud.com/v2/864477/flavors/performance1-2", |
| 54 | "rel": "self" |
| 55 | }, |
| 56 | { |
| 57 | "href": "https://iad.servers.api.rackspacecloud.com/864477/flavors/performance1-2", |
| 58 | "rel": "bookmark" |
| 59 | } |
| 60 | ], |
| 61 | "name": "2 GB Performance", |
| 62 | "ram": 2048, |
| 63 | "rxtx_factor": 400, |
| 64 | "swap": "", |
| 65 | "vcpus": 2 |
| 66 | } |
| 67 | ] |
| 68 | }` |
| 69 | |
| 70 | // GetOutput is a sample response from a flavor Get request. Its contents correspond to the |
| 71 | // Performance1Flavor struct. |
| 72 | const GetOutput = ` |
| 73 | { |
| 74 | "flavor": { |
| 75 | "OS-FLV-EXT-DATA:ephemeral": 0, |
| 76 | "OS-FLV-WITH-EXT-SPECS:extra_specs": { |
| 77 | "class": "performance1", |
| 78 | "disk_io_index": "40", |
| 79 | "number_of_data_disks": "0", |
| 80 | "policy_class": "performance_flavor", |
| 81 | "resize_policy_class": "performance_flavor" |
| 82 | }, |
| 83 | "disk": 20, |
| 84 | "id": "performance1-1", |
| 85 | "links": [ |
| 86 | { |
| 87 | "href": "https://iad.servers.api.rackspacecloud.com/v2/864477/flavors/performance1-1", |
| 88 | "rel": "self" |
| 89 | }, |
| 90 | { |
| 91 | "href": "https://iad.servers.api.rackspacecloud.com/864477/flavors/performance1-1", |
| 92 | "rel": "bookmark" |
| 93 | } |
| 94 | ], |
| 95 | "name": "1 GB Performance", |
| 96 | "ram": 1024, |
| 97 | "rxtx_factor": 200, |
| 98 | "swap": "", |
| 99 | "vcpus": 1 |
| 100 | } |
| 101 | } |
| 102 | ` |
| 103 | |
| 104 | // Performance1Flavor is the expected result of parsing GetOutput, or the first element of |
| 105 | // ListOutput. |
| 106 | var Performance1Flavor = os.Flavor{ |
| 107 | ID: "performance1-1", |
| 108 | Disk: 20, |
| 109 | RAM: 1024, |
| 110 | Name: "1 GB Performance", |
| 111 | RxTxFactor: 200.0, |
| 112 | Swap: 0, |
| 113 | VCPUs: 1, |
| 114 | } |
| 115 | |
| 116 | // Performance2Flavor is the second result expected from parsing ListOutput. |
| 117 | var Performance2Flavor = os.Flavor{ |
| 118 | ID: "performance1-2", |
| 119 | Disk: 40, |
| 120 | RAM: 2048, |
| 121 | Name: "2 GB Performance", |
| 122 | RxTxFactor: 400.0, |
| 123 | Swap: 0, |
| 124 | VCPUs: 2, |
| 125 | } |
| 126 | |
| 127 | // ExpectedFlavorSlice is the slice of Flavor structs that are expected to be parsed from |
| 128 | // ListOutput. |
| 129 | var ExpectedFlavorSlice = []os.Flavor{Performance1Flavor, Performance2Flavor} |