@@ -4,34 +4,27 @@ import (
44 g "goa.design/goa/v3/dsl"
55)
66
7- var InstanceInterface = g .Type ("InstanceInterface " , func () {
8- g .Attribute ( "network_type" , g . String , func () {
9- g . Description ( "The type of network for this interface." )
10- g .Enum ( "docker" , "host " )
11- g .Example ( "docker " )
7+ var InstanceSubscription = g .Type ("InstanceSubscription " , func () {
8+ g .Description ( "Status information for a Spock subscription." )
9+ g . Attribute ( "provider_node" , g . String , func () {
10+ g .Example ( "n2 " )
11+ g .Description ( "The Spock node name of the provider for this subscription. " )
1212 })
13- g .Attribute ("network_id " , g .String , func () {
14- g .Description ( "The unique identifier of the network for this interface. " )
15- g .Example ( "l5imrq28sh6s " )
13+ g .Attribute ("name " , g .String , func () {
14+ g .Example ( "sub_n1n2 " )
15+ g .Description ( "The name of the subscription. " )
1616 })
17- g .Attribute ("hostname" , g .String , func () {
18- g .Description ("The hostname of the instance on this interface." )
19- g .Example ("postgres-n1" )
20- })
21- g .Attribute ("ipv4_address" , g .String , func () {
22- g .Format (g .FormatIPv4 )
23- g .Description ("The IPv4 address of the instance on this interface." )
24- g .Example ("10.1.0.113" )
25- })
26- g .Attribute ("port" , g .Int , func () {
27- g .Description ("The Postgres port for the instance on this interface." )
28- g .Example (5432 )
17+ g .Attribute ("status" , g .String , func () {
18+ g .Example ("replicating" )
19+ g .Example ("down" )
20+ g .Description ("The current status of the subscription." )
2921 })
3022
31- g .Required ("network_type " , "port " )
23+ g .Required ("provider_node " , "name" , "status " )
3224})
3325
3426var Instance = g .ResultType ("Instance" , func () {
27+ g .Description ("An instance of pgEdge Postgres running on a host." )
3528 g .Attributes (func () {
3629 g .Attribute ("id" , g .String , func () {
3730 g .Format (g .FormatUUID )
@@ -53,17 +46,20 @@ var Instance = g.ResultType("Instance", func() {
5346 })
5447 g .Attribute ("updated_at" , g .String , func () {
5548 g .Format (g .FormatDateTime )
56- g .Description ("The time that the instance was last updated." )
49+ g .Description ("The time that the instance was last modified." )
50+ })
51+ g .Attribute ("status_updated_at" , g .String , func () {
52+ g .Format (g .FormatDateTime )
53+ g .Description ("The time that the instance status information was last updated." )
5754 })
5855 g .Attribute ("state" , g .String , func () {
5956 g .Enum (
6057 "creating" ,
6158 "modifying" ,
6259 "backing_up" ,
63- "restoring" ,
64- "deleting" ,
6560 "available" ,
6661 "degraded" ,
62+ "failed" ,
6763 "unknown" ,
6864 )
6965 })
@@ -89,8 +85,9 @@ var Instance = g.ResultType("Instance", func() {
8985 g .Attribute ("role" , g .String , func () {
9086 g .Enum ("replica" , "primary" )
9187 })
92- g .Attribute ("read_only" , g .Boolean , func () {
93- g .Description ("True if this instance is in read-only mode." )
88+ g .Attribute ("read_only" , g .String , func () {
89+ g .Description ("The current spock.readonly setting." )
90+ g .Example ("off" )
9491 })
9592 g .Attribute ("pending_restart" , g .Boolean , func () {
9693 g .Description ("True if this instance is pending to be restarted from a configuration change." )
@@ -106,8 +103,25 @@ var Instance = g.ResultType("Instance", func() {
106103 g .Description ("The version of Spock for this instance." )
107104 g .Example ("4.0.9" )
108105 })
109- g .Attribute ("interfaces" , g .ArrayOf (InstanceInterface ), func () {
110- g .Description ("All interfaces that this instance serves on." )
106+ g .Attribute ("hostname" , g .String , func () {
107+ g .Description ("The hostname of the host that's running this instance." )
108+ g .Example ("i-0123456789abcdef.ec2.internal" )
109+ })
110+ g .Attribute ("ipv4_address" , g .String , func () {
111+ g .Description ("The IPv4 address of the host that's running this instance." )
112+ g .Format (g .FormatIPv4 )
113+ g .Example ("10.24.34.0" )
114+ })
115+ g .Attribute ("port" , g .Int , func () {
116+ g .Description ("The host port that Postgres is listening on for this instance." )
117+ g .Example (5432 )
118+ })
119+ g .Attribute ("subscriptions" , g .ArrayOf (InstanceSubscription ), func () {
120+ g .Description ("Status information for this instance's Spock subscriptions." )
121+ })
122+ g .Attribute ("error" , g .String , func () {
123+ g .Description ("An error message if the instance is in an error state." )
124+ g .Example ("failed to get patroni status: connection refused" )
111125 })
112126 })
113127
@@ -117,6 +131,7 @@ var Instance = g.ResultType("Instance", func() {
117131 g .Attribute ("node_name" )
118132 g .Attribute ("created_at" )
119133 g .Attribute ("updated_at" )
134+ g .Attribute ("status_updated_at" )
120135 g .Attribute ("state" )
121136 g .Attribute ("patroni_state" )
122137 g .Attribute ("role" )
@@ -125,7 +140,11 @@ var Instance = g.ResultType("Instance", func() {
125140 g .Attribute ("patroni_paused" )
126141 g .Attribute ("postgres_version" )
127142 g .Attribute ("spock_version" )
128- g .Attribute ("interfaces" )
143+ g .Attribute ("hostname" )
144+ g .Attribute ("ipv4_address" )
145+ g .Attribute ("port" )
146+ g .Attribute ("subscriptions" )
147+ g .Attribute ("error" )
129148 })
130149
131150 g .View ("abbreviated" , func () {
0 commit comments