Keith Byrne | bda4859 | 2016-03-23 11:37:08 +0000 | [diff] [blame] | 1 | // +build fixtures |
| 2 | |
Jamie Hannaford | b9aa87f | 2015-10-07 14:12:59 +0200 | [diff] [blame] | 3 | package configurations |
| 4 | |
| 5 | import ( |
| 6 | "fmt" |
Jamie Hannaford | e65ad95 | 2015-11-16 14:05:11 +0100 | [diff] [blame] | 7 | "time" |
Jamie Hannaford | b9aa87f | 2015-10-07 14:12:59 +0200 | [diff] [blame] | 8 | |
| 9 | os "github.com/rackspace/gophercloud/openstack/db/v1/configurations" |
| 10 | ) |
| 11 | |
Jamie Hannaford | e65ad95 | 2015-11-16 14:05:11 +0100 | [diff] [blame] | 12 | var ( |
| 13 | timestamp = "2015-11-12T14:22:42Z" |
| 14 | timeVal, _ = time.Parse(time.RFC3339, timestamp) |
| 15 | ) |
| 16 | |
| 17 | var singleConfigJSON = ` |
Jamie Hannaford | b9aa87f | 2015-10-07 14:12:59 +0200 | [diff] [blame] | 18 | { |
Jamie Hannaford | e65ad95 | 2015-11-16 14:05:11 +0100 | [diff] [blame] | 19 | "created": "` + timestamp + `", |
Jamie Hannaford | b9aa87f | 2015-10-07 14:12:59 +0200 | [diff] [blame] | 20 | "datastore_name": "mysql", |
| 21 | "datastore_version_id": "b00000b0-00b0-0b00-00b0-000b000000bb", |
| 22 | "datastore_version_name": "5.6", |
| 23 | "description": "example_description", |
| 24 | "id": "005a8bb7-a8df-40ee-b0b7-fc144641abc2", |
| 25 | "name": "example-configuration-name", |
Jamie Hannaford | e65ad95 | 2015-11-16 14:05:11 +0100 | [diff] [blame] | 26 | "updated": "` + timestamp + `" |
Jamie Hannaford | b9aa87f | 2015-10-07 14:12:59 +0200 | [diff] [blame] | 27 | } |
| 28 | ` |
| 29 | |
Jamie Hannaford | e65ad95 | 2015-11-16 14:05:11 +0100 | [diff] [blame] | 30 | var singleConfigWithValuesJSON = ` |
Jamie Hannaford | b9aa87f | 2015-10-07 14:12:59 +0200 | [diff] [blame] | 31 | { |
Jamie Hannaford | e65ad95 | 2015-11-16 14:05:11 +0100 | [diff] [blame] | 32 | "created": "` + timestamp + `", |
Jamie Hannaford | b9aa87f | 2015-10-07 14:12:59 +0200 | [diff] [blame] | 33 | "datastore_name": "mysql", |
| 34 | "datastore_version_id": "b00000b0-00b0-0b00-00b0-000b000000bb", |
| 35 | "datastore_version_name": "5.6", |
| 36 | "description": "example description", |
| 37 | "id": "005a8bb7-a8df-40ee-b0b7-fc144641abc2", |
| 38 | "instance_count": 0, |
| 39 | "name": "example-configuration-name", |
Jamie Hannaford | e65ad95 | 2015-11-16 14:05:11 +0100 | [diff] [blame] | 40 | "updated": "` + timestamp + `", |
Jamie Hannaford | b9aa87f | 2015-10-07 14:12:59 +0200 | [diff] [blame] | 41 | "values": { |
| 42 | "collation_server": "latin1_swedish_ci", |
| 43 | "connect_timeout": 120 |
| 44 | } |
| 45 | } |
| 46 | ` |
| 47 | |
| 48 | var ( |
| 49 | listConfigsJSON = fmt.Sprintf(`{"configurations": [%s]}`, singleConfigJSON) |
| 50 | getConfigJSON = fmt.Sprintf(`{"configuration": %s}`, singleConfigJSON) |
| 51 | createConfigJSON = fmt.Sprintf(`{"configuration": %s}`, singleConfigWithValuesJSON) |
| 52 | ) |
| 53 | |
| 54 | var createReq = ` |
| 55 | { |
| 56 | "configuration": { |
| 57 | "datastore": { |
| 58 | "type": "a00000a0-00a0-0a00-00a0-000a000000aa", |
| 59 | "version": "b00000b0-00b0-0b00-00b0-000b000000bb" |
| 60 | }, |
| 61 | "description": "example description", |
| 62 | "name": "example-configuration-name", |
| 63 | "values": { |
| 64 | "collation_server": "latin1_swedish_ci", |
| 65 | "connect_timeout": 120 |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | ` |
| 70 | |
| 71 | var updateReq = ` |
| 72 | { |
| 73 | "configuration": { |
| 74 | "values": { |
| 75 | "connect_timeout": 300 |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | ` |
| 80 | |
| 81 | var listInstancesJSON = ` |
| 82 | { |
| 83 | "instances": [ |
| 84 | { |
| 85 | "id": "d4603f69-ec7e-4e9b-803f-600b9205576f", |
| 86 | "name": "json_rack_instance" |
| 87 | } |
| 88 | ] |
| 89 | } |
| 90 | ` |
| 91 | |
| 92 | var listParamsJSON = ` |
| 93 | { |
| 94 | "configuration-parameters": [ |
| 95 | { |
| 96 | "max": 1, |
| 97 | "min": 0, |
| 98 | "name": "innodb_file_per_table", |
| 99 | "restart_required": true, |
| 100 | "type": "integer" |
| 101 | }, |
| 102 | { |
| 103 | "max": 4294967296, |
| 104 | "min": 0, |
| 105 | "name": "key_buffer_size", |
| 106 | "restart_required": false, |
| 107 | "type": "integer" |
| 108 | }, |
| 109 | { |
| 110 | "max": 65535, |
| 111 | "min": 2, |
| 112 | "name": "connect_timeout", |
| 113 | "restart_required": false, |
| 114 | "type": "integer" |
| 115 | }, |
| 116 | { |
| 117 | "max": 4294967296, |
| 118 | "min": 0, |
| 119 | "name": "join_buffer_size", |
| 120 | "restart_required": false, |
| 121 | "type": "integer" |
| 122 | } |
| 123 | ] |
| 124 | } |
| 125 | ` |
| 126 | |
| 127 | var getParamJSON = ` |
| 128 | { |
| 129 | "max": 1, |
| 130 | "min": 0, |
| 131 | "name": "innodb_file_per_table", |
| 132 | "restart_required": true, |
| 133 | "type": "integer" |
| 134 | } |
| 135 | ` |
| 136 | |
| 137 | var exampleConfig = os.Config{ |
Jamie Hannaford | e65ad95 | 2015-11-16 14:05:11 +0100 | [diff] [blame] | 138 | Created: timeVal, |
Jamie Hannaford | b9aa87f | 2015-10-07 14:12:59 +0200 | [diff] [blame] | 139 | DatastoreName: "mysql", |
| 140 | DatastoreVersionID: "b00000b0-00b0-0b00-00b0-000b000000bb", |
| 141 | DatastoreVersionName: "5.6", |
| 142 | Description: "example_description", |
| 143 | ID: "005a8bb7-a8df-40ee-b0b7-fc144641abc2", |
| 144 | Name: "example-configuration-name", |
Jamie Hannaford | e65ad95 | 2015-11-16 14:05:11 +0100 | [diff] [blame] | 145 | Updated: timeVal, |
Jamie Hannaford | b9aa87f | 2015-10-07 14:12:59 +0200 | [diff] [blame] | 146 | } |
| 147 | |
| 148 | var exampleConfigWithValues = os.Config{ |
Jamie Hannaford | e65ad95 | 2015-11-16 14:05:11 +0100 | [diff] [blame] | 149 | Created: timeVal, |
Jamie Hannaford | b9aa87f | 2015-10-07 14:12:59 +0200 | [diff] [blame] | 150 | DatastoreName: "mysql", |
| 151 | DatastoreVersionID: "b00000b0-00b0-0b00-00b0-000b000000bb", |
| 152 | DatastoreVersionName: "5.6", |
| 153 | Description: "example description", |
| 154 | ID: "005a8bb7-a8df-40ee-b0b7-fc144641abc2", |
| 155 | Name: "example-configuration-name", |
Jamie Hannaford | e65ad95 | 2015-11-16 14:05:11 +0100 | [diff] [blame] | 156 | Updated: timeVal, |
Jamie Hannaford | b9aa87f | 2015-10-07 14:12:59 +0200 | [diff] [blame] | 157 | Values: map[string]interface{}{ |
| 158 | "collation_server": "latin1_swedish_ci", |
| 159 | "connect_timeout": 120, |
| 160 | }, |
| 161 | } |