blob: 01a9325d09b6e4454367b68af8ab1e23eb9c359a [file] [log] [blame]
Keith Byrnebda48592016-03-23 11:37:08 +00001// +build fixtures
2
Jamie Hannafordb9aa87f2015-10-07 14:12:59 +02003package configurations
4
5import (
6 "fmt"
Jamie Hannaforde65ad952015-11-16 14:05:11 +01007 "time"
Jamie Hannafordb9aa87f2015-10-07 14:12:59 +02008
9 os "github.com/rackspace/gophercloud/openstack/db/v1/configurations"
10)
11
Jamie Hannaforde65ad952015-11-16 14:05:11 +010012var (
13 timestamp = "2015-11-12T14:22:42Z"
14 timeVal, _ = time.Parse(time.RFC3339, timestamp)
15)
16
17var singleConfigJSON = `
Jamie Hannafordb9aa87f2015-10-07 14:12:59 +020018{
Jamie Hannaforde65ad952015-11-16 14:05:11 +010019 "created": "` + timestamp + `",
Jamie Hannafordb9aa87f2015-10-07 14:12:59 +020020 "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 Hannaforde65ad952015-11-16 14:05:11 +010026 "updated": "` + timestamp + `"
Jamie Hannafordb9aa87f2015-10-07 14:12:59 +020027}
28`
29
Jamie Hannaforde65ad952015-11-16 14:05:11 +010030var singleConfigWithValuesJSON = `
Jamie Hannafordb9aa87f2015-10-07 14:12:59 +020031{
Jamie Hannaforde65ad952015-11-16 14:05:11 +010032 "created": "` + timestamp + `",
Jamie Hannafordb9aa87f2015-10-07 14:12:59 +020033 "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 Hannaforde65ad952015-11-16 14:05:11 +010040 "updated": "` + timestamp + `",
Jamie Hannafordb9aa87f2015-10-07 14:12:59 +020041 "values": {
42 "collation_server": "latin1_swedish_ci",
43 "connect_timeout": 120
44 }
45}
46`
47
48var (
49 listConfigsJSON = fmt.Sprintf(`{"configurations": [%s]}`, singleConfigJSON)
50 getConfigJSON = fmt.Sprintf(`{"configuration": %s}`, singleConfigJSON)
51 createConfigJSON = fmt.Sprintf(`{"configuration": %s}`, singleConfigWithValuesJSON)
52)
53
54var 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
71var updateReq = `
72{
73 "configuration": {
74 "values": {
75 "connect_timeout": 300
76 }
77 }
78}
79`
80
81var listInstancesJSON = `
82{
83 "instances": [
84 {
85 "id": "d4603f69-ec7e-4e9b-803f-600b9205576f",
86 "name": "json_rack_instance"
87 }
88 ]
89}
90`
91
92var 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
127var getParamJSON = `
128{
129 "max": 1,
130 "min": 0,
131 "name": "innodb_file_per_table",
132 "restart_required": true,
133 "type": "integer"
134}
135`
136
137var exampleConfig = os.Config{
Jamie Hannaforde65ad952015-11-16 14:05:11 +0100138 Created: timeVal,
Jamie Hannafordb9aa87f2015-10-07 14:12:59 +0200139 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 Hannaforde65ad952015-11-16 14:05:11 +0100145 Updated: timeVal,
Jamie Hannafordb9aa87f2015-10-07 14:12:59 +0200146}
147
148var exampleConfigWithValues = os.Config{
Jamie Hannaforde65ad952015-11-16 14:05:11 +0100149 Created: timeVal,
Jamie Hannafordb9aa87f2015-10-07 14:12:59 +0200150 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 Hannaforde65ad952015-11-16 14:05:11 +0100156 Updated: timeVal,
Jamie Hannafordb9aa87f2015-10-07 14:12:59 +0200157 Values: map[string]interface{}{
158 "collation_server": "latin1_swedish_ci",
159 "connect_timeout": 120,
160 },
161}