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