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
3f355e4
commit 3986925
Showing
20 changed files
with
1,164 additions
and
631 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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, "+config ") | ||
w := 6 | ||
for i, config := range m.Config { | ||
if i > 0 { | ||
fmt.Fprint(out, ", ") | ||
w += 2 | ||
} | ||
str := config.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:"'+' 'secrets' @@ (',' @@)*" 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, "+secrets ") | ||
w := 6 | ||
for i, secret := range m.Secrets { | ||
if i > 0 { | ||
fmt.Fprint(out, ", ") | ||
w += 2 | ||
} | ||
str := secret.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), | ||
} | ||
} |
Oops, something went wrong.