blob: ae654161547ae78a1a53440bd5a5afb2ccbc79b6 [file] [log] [blame]
Jamie Hannaforded7f4532015-02-17 14:56:30 +01001package configurations
2
Jamie Hannaforde65ad952015-11-16 14:05:11 +01003import (
4 "fmt"
5 "time"
6)
Jamie Hannaforded7f4532015-02-17 14:56:30 +01007
Jamie Hannaforde65ad952015-11-16 14:05:11 +01008var (
9 timestamp = "2015-11-12T14:22:42Z"
10 timeVal, _ = time.Parse(time.RFC3339, timestamp)
11)
12
13var singleConfigJSON = `
Jamie Hannaforded7f4532015-02-17 14:56:30 +010014{
Jamie Hannaforde65ad952015-11-16 14:05:11 +010015 "created": "` + timestamp + `",
Jamie Hannaforded7f4532015-02-17 14:56:30 +010016 "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 Hannaforde65ad952015-11-16 14:05:11 +010022 "updated": "` + timestamp + `"
Jamie Hannaforded7f4532015-02-17 14:56:30 +010023}
24`
25
Jamie Hannaforde65ad952015-11-16 14:05:11 +010026var singleConfigWithValuesJSON = `
Jamie Hannaforded7f4532015-02-17 14:56:30 +010027{
Jamie Hannaforde65ad952015-11-16 14:05:11 +010028 "created": "` + timestamp + `",
Jamie Hannaforded7f4532015-02-17 14:56:30 +010029 "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 Hannaforde65ad952015-11-16 14:05:11 +010036 "updated": "` + timestamp + `",
Jamie Hannaforded7f4532015-02-17 14:56:30 +010037 "values": {
38 "collation_server": "latin1_swedish_ci",
39 "connect_timeout": 120
40 }
41}
42`
43
44var (
Jamie Hannafordd2b755f2015-10-07 14:01:57 +020045 ListConfigsJSON = fmt.Sprintf(`{"configurations": [%s]}`, singleConfigJSON)
46 GetConfigJSON = fmt.Sprintf(`{"configuration": %s}`, singleConfigJSON)
47 CreateConfigJSON = fmt.Sprintf(`{"configuration": %s}`, singleConfigWithValuesJSON)
Jamie Hannaforded7f4532015-02-17 14:56:30 +010048)
49
Jamie Hannafordd2b755f2015-10-07 14:01:57 +020050var CreateReq = `
Jamie Hannaforded7f4532015-02-17 14:56:30 +010051{
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 Hannafordd2b755f2015-10-07 14:01:57 +020067var UpdateReq = `
Jamie Hannaforded7f4532015-02-17 14:56:30 +010068{
69 "configuration": {
70 "values": {
71 "connect_timeout": 300
72 }
73 }
74}
75`
76
Jamie Hannafordd2b755f2015-10-07 14:01:57 +020077var ListInstancesJSON = `
Jamie Hannaforded7f4532015-02-17 14:56:30 +010078{
79 "instances": [
80 {
81 "id": "d4603f69-ec7e-4e9b-803f-600b9205576f",
82 "name": "json_rack_instance"
83 }
84 ]
85}
86`
87
Jamie Hannafordd2b755f2015-10-07 14:01:57 +020088var ListParamsJSON = `
Jamie Hannaford23867bb2015-02-17 15:56:48 +010089{
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 Hannafordd2b755f2015-10-07 14:01:57 +0200123var GetParamJSON = `
Jamie Hannaford23867bb2015-02-17 15:56:48 +0100124{
125 "max": 1,
126 "min": 0,
127 "name": "innodb_file_per_table",
128 "restart_required": true,
129 "type": "integer"
130}
131`
132
Jamie Hannafordd2b755f2015-10-07 14:01:57 +0200133var ExampleConfig = Config{
Jamie Hannaforde65ad952015-11-16 14:05:11 +0100134 Created: timeVal,
Jamie Hannaforded7f4532015-02-17 14:56:30 +0100135 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 Hannaforde65ad952015-11-16 14:05:11 +0100141 Updated: timeVal,
Jamie Hannaforded7f4532015-02-17 14:56:30 +0100142}
143
Jamie Hannafordd2b755f2015-10-07 14:01:57 +0200144var ExampleConfigWithValues = Config{
Jamie Hannaforde65ad952015-11-16 14:05:11 +0100145 Created: timeVal,
Jamie Hannaforded7f4532015-02-17 14:56:30 +0100146 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 Hannaforde65ad952015-11-16 14:05:11 +0100152 Updated: timeVal,
Jamie Hannaforded7f4532015-02-17 14:56:30 +0100153 Values: map[string]interface{}{
154 "collation_server": "latin1_swedish_ci",
155 "connect_timeout": 120,
156 },
157}