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