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