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