Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions api/design/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,11 @@ var _ = g.Service("control-plane", func() {
g.Payload(func() {
g.Attribute("host_id", g.String, func() {
g.Description("ID of the host to get.")
g.Format(g.FormatUUID)
g.Example("de3b1388-1f0c-42f1-a86c-59ab72f255ec")
})

g.Required("host_id")
})
g.Result(Host)
g.Error("cluster_not_initialized")
Expand All @@ -169,8 +172,11 @@ var _ = g.Service("control-plane", func() {
g.Payload(func() {
g.Attribute("host_id", g.String, func() {
g.Description("ID of the host to remove.")
g.Format(g.FormatUUID)
g.Example("de3b1388-1f0c-42f1-a86c-59ab72f255ec")
})

g.Required("host_id")
})
g.Error("cluster_not_initialized")
g.Error("invalid_input")
Expand Down Expand Up @@ -222,8 +228,11 @@ var _ = g.Service("control-plane", func() {
g.Payload(func() {
g.Attribute("database_id", g.String, func() {
g.Description("ID of the database to get.")
g.Format(g.FormatUUID)
g.Example("02f1a7db-fca8-4521-b57a-2a375c1ced51")
})

g.Required("database_id")
})
g.Result(Database, func() {
g.View("default")
Expand All @@ -245,13 +254,17 @@ var _ = g.Service("control-plane", func() {
g.Payload(func() {
g.Attribute("database_id", g.String, func() {
g.Description("ID of the database to update.")
g.Format(g.FormatUUID)
g.Example("02f1a7db-fca8-4521-b57a-2a375c1ced51")
})
g.Attribute("force_update", g.Boolean, func() {
g.Description("Force update the database even if the spec is the same.")
g.Default(false)
g.Example(true)
})
g.Attribute("request", UpdateDatabaseRequest)

g.Required("database_id", "request")
})
g.Result(UpdateDatabaseResponse)
g.Error("cluster_not_initialized")
Expand Down Expand Up @@ -306,6 +319,7 @@ var _ = g.Service("control-plane", func() {
})
g.Attribute("node_name", g.String, func() {
g.Description("Name of the node to back up.")
g.Pattern(nodeNamePattern)
g.Example("n1")
})
g.Attribute("options", BackupOptions)
Expand Down Expand Up @@ -487,5 +501,6 @@ var APIError = g.Type("APIError", func() {
g.Description("A Control Plane API error.")
g.ErrorName("name", g.String, "The name of the error.")
g.Attribute("message", g.String, "The error message.")

g.Required("name", "message")
})
2 changes: 2 additions & 0 deletions api/design/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ var BackupOptions = g.Type("BackupOptions", func() {
})
g.Attribute("annotations", g.MapOf(g.String, g.String), func() {
g.Description("Annotations for the backup.")
g.MaxLength(32)
g.Example(map[string]string{
"key": "value",
})
})
g.Attribute("backup_options", g.MapOf(g.String, g.String), func() {
g.Description("Options for the backup.")
g.MaxLength(32)
g.Example(map[string]string{
"archive-check": "n",
})
Expand Down
5 changes: 4 additions & 1 deletion api/design/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var ClusterJoinToken = g.Type("ClusterJoinToken", func() {
var ClusterJoinRequest = g.Type("ClusterJoinRequest", func() {
g.Attribute("token", g.String, func() {
g.Description("Token to join the cluster.")
g.Pattern(`^PGEDGE-[\w]{64}-[\w]{32}$`)
g.Example("PGEDGE-dd440afcf5de20ef8e8cf54f6cb9f125fd55f90e64faa94b906130b31235e730-41e975f41d7ea61058f2fe2572cb52dd")
})
g.Attribute("host_id", g.String, func() {
Expand All @@ -60,6 +61,8 @@ var ClusterJoinRequest = g.Type("ClusterJoinRequest", func() {
})
g.Attribute("hostname", g.String, func() {
g.Description("The hostname of the host that's joining the cluster.")
g.MinLength(3)
g.MaxLength(128)
g.Example("ip-10-1-0-113.ec2.internal")
})
g.Attribute("ipv4_address", g.String, func() {
Expand Down Expand Up @@ -124,5 +127,5 @@ var ClusterJoinOptions = g.Type("ClusterJoinOptions", func() {
g.Description("Credentials for the new host joining the cluster.")
})

g.Required("peer")
g.Required("peer", "credentials")
})
Loading