generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add secrets / config to a verbs metadata
fixes: #1083
- Loading branch information
1 parent
4f2606e
commit 58e9ed0
Showing
17 changed files
with
1,141 additions
and
616 deletions.
There are no files selected for viewing
1,404 changes: 803 additions & 601 deletions
1,404
backend/protos/xyz/block/ftl/v1/schema/schema.pb.go
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
frontend/console/src/protos/xyz/block/ftl/v1/schema/schema_pb.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package schema | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"google.golang.org/protobuf/proto" | ||
|
||
schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema" | ||
) | ||
|
||
// MetadataConfig represents a metadata block with a list of config items that are used. | ||
// | ||
//protobuf:10,optional | ||
type MetadataConfig struct { | ||
Pos Position `parser:"" protobuf:"1,optional"` | ||
|
||
Config []*Ref `parser:"'+' 'config' @@ (',' @@)*" protobuf:"2"` | ||
} | ||
|
||
var _ Metadata = (*MetadataConfig)(nil) | ||
|
||
func (m *MetadataConfig) Position() Position { return m.Pos } | ||
func (m *MetadataConfig) String() string { | ||
out := &strings.Builder{} | ||
fmt.Fprint(out, "+calls ") | ||
w := 6 | ||
for i, call := range m.Config { | ||
if i > 0 { | ||
fmt.Fprint(out, ", ") | ||
w += 2 | ||
} | ||
str := call.String() | ||
if w+len(str) > 70 { | ||
w = 6 | ||
fmt.Fprint(out, "\n ") | ||
} | ||
w += len(str) | ||
fmt.Fprint(out, str) | ||
} | ||
fmt.Fprint(out) | ||
return out.String() | ||
} | ||
|
||
func (m *MetadataConfig) schemaChildren() []Node { | ||
out := make([]Node, 0, len(m.Config)) | ||
for _, ref := range m.Config { | ||
out = append(out, ref) | ||
} | ||
return out | ||
} | ||
func (*MetadataConfig) schemaMetadata() {} | ||
|
||
func (m *MetadataConfig) ToProto() proto.Message { | ||
return &schemapb.MetadataConfig{ | ||
Pos: posToProto(m.Pos), | ||
Config: nodeListToProto[*schemapb.Ref](m.Config), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package schema | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"google.golang.org/protobuf/proto" | ||
|
||
schemapb "github.com/TBD54566975/ftl/backend/protos/xyz/block/ftl/v1/schema" | ||
) | ||
|
||
// MetadataSecrets represents a metadata block with a list of config items that are used. | ||
// | ||
//protobuf:11,optional | ||
type MetadataSecrets struct { | ||
Pos Position `parser:"" protobuf:"1,optional"` | ||
|
||
Secrets []*Ref `parser:"'+' 'config' @@ (',' @@)*" protobuf:"2"` | ||
} | ||
|
||
var _ Metadata = (*MetadataSecrets)(nil) | ||
|
||
func (m *MetadataSecrets) Position() Position { return m.Pos } | ||
func (m *MetadataSecrets) String() string { | ||
out := &strings.Builder{} | ||
fmt.Fprint(out, "+calls ") | ||
w := 6 | ||
for i, call := range m.Secrets { | ||
if i > 0 { | ||
fmt.Fprint(out, ", ") | ||
w += 2 | ||
} | ||
str := call.String() | ||
if w+len(str) > 70 { | ||
w = 6 | ||
fmt.Fprint(out, "\n ") | ||
} | ||
w += len(str) | ||
fmt.Fprint(out, str) | ||
} | ||
fmt.Fprint(out) | ||
return out.String() | ||
} | ||
|
||
func (m *MetadataSecrets) schemaChildren() []Node { | ||
out := make([]Node, 0, len(m.Secrets)) | ||
for _, ref := range m.Secrets { | ||
out = append(out, ref) | ||
} | ||
return out | ||
} | ||
func (*MetadataSecrets) schemaMetadata() {} | ||
|
||
func (m *MetadataSecrets) ToProto() proto.Message { | ||
return &schemapb.MetadataSecrets{ | ||
Pos: posToProto(m.Pos), | ||
Secrets: nodeListToProto[*schemapb.Ref](m.Secrets), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.