blob: eb796eb3753ad41831483ee0cff0d84074eeb0d5 [file] [log] [blame]
Keith Byrnebda48592016-03-23 11:37:08 +00001// +build fixtures
2
Jamie Hannaford52dbcee2015-10-06 16:09:56 +02003package datastores
4
5import (
6 "fmt"
7
8 "github.com/rackspace/gophercloud"
9)
10
11const version1JSON = `
12{
13 "id": "b00000b0-00b0-0b00-00b0-000b000000bb",
14 "links": [
15 {
16 "href": "https://10.240.28.38:8779/v1.0/1234/datastores/versions/b00000b0-00b0-0b00-00b0-000b000000bb",
17 "rel": "self"
18 },
19 {
20 "href": "https://10.240.28.38:8779/datastores/versions/b00000b0-00b0-0b00-00b0-000b000000bb",
21 "rel": "bookmark"
22 }
23 ],
24 "name": "5.1"
25}
26`
27
28const version2JSON = `
29{
30 "id": "c00000b0-00c0-0c00-00c0-000b000000cc",
31 "links": [
32 {
33 "href": "https://10.240.28.38:8779/v1.0/1234/datastores/versions/c00000b0-00c0-0c00-00c0-000b000000cc",
34 "rel": "self"
35 },
36 {
37 "href": "https://10.240.28.38:8779/datastores/versions/c00000b0-00c0-0c00-00c0-000b000000cc",
38 "rel": "bookmark"
39 }
40 ],
41 "name": "5.2"
42}
43`
44
45var versionsJSON = fmt.Sprintf(`"versions": [%s, %s]`, version1JSON, version2JSON)
46
47var singleDSJSON = fmt.Sprintf(`
48{
49 "default_version": "c00000b0-00c0-0c00-00c0-000b000000cc",
50 "id": "10000000-0000-0000-0000-000000000001",
51 "links": [
52 {
53 "href": "https://10.240.28.38:8779/v1.0/1234/datastores/10000000-0000-0000-0000-000000000001",
54 "rel": "self"
55 },
56 {
57 "href": "https://10.240.28.38:8779/datastores/10000000-0000-0000-0000-000000000001",
58 "rel": "bookmark"
59 }
60 ],
61 "name": "mysql",
62 %s
63}
64`, versionsJSON)
65
66var (
67 ListDSResp = fmt.Sprintf(`{"datastores":[%s]}`, singleDSJSON)
68 GetDSResp = fmt.Sprintf(`{"datastore":%s}`, singleDSJSON)
69 ListVersionsResp = fmt.Sprintf(`{%s}`, versionsJSON)
70 GetVersionResp = fmt.Sprintf(`{"version":%s}`, version1JSON)
71)
72
73var ExampleVersion1 = Version{
74 ID: "b00000b0-00b0-0b00-00b0-000b000000bb",
75 Links: []gophercloud.Link{
76 gophercloud.Link{Rel: "self", Href: "https://10.240.28.38:8779/v1.0/1234/datastores/versions/b00000b0-00b0-0b00-00b0-000b000000bb"},
77 gophercloud.Link{Rel: "bookmark", Href: "https://10.240.28.38:8779/datastores/versions/b00000b0-00b0-0b00-00b0-000b000000bb"},
78 },
79 Name: "5.1",
80}
81
82var exampleVersion2 = Version{
83 ID: "c00000b0-00c0-0c00-00c0-000b000000cc",
84 Links: []gophercloud.Link{
85 gophercloud.Link{Rel: "self", Href: "https://10.240.28.38:8779/v1.0/1234/datastores/versions/c00000b0-00c0-0c00-00c0-000b000000cc"},
86 gophercloud.Link{Rel: "bookmark", Href: "https://10.240.28.38:8779/datastores/versions/c00000b0-00c0-0c00-00c0-000b000000cc"},
87 },
88 Name: "5.2",
89}
90
91var ExampleVersions = []Version{ExampleVersion1, exampleVersion2}
92
93var ExampleDatastore = Datastore{
94 DefaultVersion: "c00000b0-00c0-0c00-00c0-000b000000cc",
95 ID: "10000000-0000-0000-0000-000000000001",
96 Links: []gophercloud.Link{
97 gophercloud.Link{Rel: "self", Href: "https://10.240.28.38:8779/v1.0/1234/datastores/10000000-0000-0000-0000-000000000001"},
98 gophercloud.Link{Rel: "bookmark", Href: "https://10.240.28.38:8779/datastores/10000000-0000-0000-0000-000000000001"},
99 },
100 Name: "mysql",
101 Versions: ExampleVersions,
102}