Skip to content

Commit

Permalink
chore: move resource outputs in a separate message (#2741)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvmakine authored Sep 20, 2024
1 parent 2e01243 commit 3585981
Show file tree
Hide file tree
Showing 4 changed files with 291 additions and 84 deletions.
236 changes: 185 additions & 51 deletions backend/protos/xyz/block/ftl/v1beta1/provisioner/resource.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions backend/protos/xyz/block/ftl/v1beta1/provisioner/resource.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,20 @@ message Resource {

// Resource types
//
// we use convention of prefixing field names with out_ if they are populated
// after being provisioned by the provisioning engine
// any output created by the provisioner is stored in a field called "output"

message PostgresResource {
// fields populated after the resource has been created
string out_read_endpoint = 101;
string out_write_endpoint = 102;
message PostgresResourceOutput {
string read_endpoint = 1;
string write_endpoint = 2;
}
PostgresResourceOutput output = 1;
}

message MysqlResource {
// fields populated after the resource has been created
string out_read_endpoint = 101;
string out_write_endpoint = 102;
message MysqlResourceOutput {
string read_endpoint = 1;
string write_endpoint = 2;
}
MysqlResourceOutput output = 1;
}
8 changes: 4 additions & 4 deletions cmd/ftl-provisioner-cloudformation/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,16 @@ func updateResources(outputs []types.Output, update []*provisioner.Resource) err
if postgres, ok := resource.Resource.(*provisioner.Resource_Postgres); ok {
switch key.PropertyName {
case PropertyDBReadEndpoint:
postgres.Postgres.OutReadEndpoint = *output.OutputValue
postgres.Postgres.Output.ReadEndpoint = *output.OutputValue
case PropertyDBWriteEndpoint:
postgres.Postgres.OutWriteEndpoint = *output.OutputValue
postgres.Postgres.Output.WriteEndpoint = *output.OutputValue
}
} else if mysql, ok := resource.Resource.(*provisioner.Resource_Mysql); ok {
switch key.PropertyName {
case PropertyDBReadEndpoint:
mysql.Mysql.OutReadEndpoint = *output.OutputValue
mysql.Mysql.Output.ReadEndpoint = *output.OutputValue
case PropertyDBWriteEndpoint:
mysql.Mysql.OutWriteEndpoint = *output.OutputValue
mysql.Mysql.Output.WriteEndpoint = *output.OutputValue
}
}
}
Expand Down
Loading

0 comments on commit 3585981

Please sign in to comment.