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