refactor: delete wrappers superseded by live entry points
Remove controlplanerpc.NewClient (superseded by NewRPCClient), Loader.Overlay (-config-overlay reaches Resolve directly), and setup.Run (RunParams is the live entry point). Move ResolverFunc into a test file, since only tests adapt functions to the egress Resolver.
This commit is contained in:
1 parent
c833b651a9
commit
f537d5f8cd
5 files changed
+11
-26
No files matched your search
@@ -135,12 +135,6 @@ func validateOverlayPath(overlayPath, basePath string, baseIsDir bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Overlay loads basePath, then replaces only the fields overlayPath sets. An
|
||||
// empty overlayPath is equivalent to File.
|
||||
func (l *Loader) Overlay(basePath, overlayPath string) (*Document, error) {
|
||||
return l.overlayFile(basePath, overlayPath)
|
||||
}
|
||||
|
||||
func (l *Loader) overlayFile(basePath, overlayPath string) (*Document, error) {
|
||||
doc := &Document{}
|
||||
|
||||
|
||||
@@ -70,14 +70,7 @@ type Params struct {
|
||||
// SecretSink.
|
||||
}
|
||||
|
||||
// Run drives the setup flow and returns the TOML edits to apply. It writes no
|
||||
// files; the caller must load the result before installing it or committing
|
||||
// secrets.
|
||||
func Run(ctx context.Context, p Prompter, discovery ModelDiscovery, secrets SecretSink, existing ExistingValues) ([]tomlwrite.Edit, error) {
|
||||
return RunParams(ctx, p, discovery, secrets, existing, Params{})
|
||||
}
|
||||
|
||||
// RunParams is Run with the question sites pre-answered from params. A zero
|
||||
// RunParams drives the setup flow with the question sites pre-answered from params. A zero
|
||||
// Params behaves exactly like Run.
|
||||
func RunParams(ctx context.Context, p Prompter, discovery ModelDiscovery, secrets SecretSink, existing ExistingValues, params Params) ([]tomlwrite.Edit, error) {
|
||||
var edits []tomlwrite.Edit
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
@@ -36,10 +35,6 @@ var (
|
||||
|
||||
type Client struct{ rpc pb.ControlPlaneServiceClient }
|
||||
|
||||
func NewClient(conn grpc.ClientConnInterface) *Client {
|
||||
return &Client{rpc: pb.NewControlPlaneServiceClient(conn)}
|
||||
}
|
||||
|
||||
func NewRPCClient(client pb.ControlPlaneServiceClient) *Client { return &Client{rpc: client} }
|
||||
|
||||
// ResourceReader is the read side of the control-plane client: one resource
|
||||
|
||||
@@ -40,13 +40,6 @@ type Resolver interface {
|
||||
Resolve(ctx context.Context, credential, service string) (string, error)
|
||||
}
|
||||
|
||||
// ResolverFunc adapts a function to Resolver.
|
||||
type ResolverFunc func(ctx context.Context, credential, service string) (string, error)
|
||||
|
||||
func (f ResolverFunc) Resolve(ctx context.Context, credential, service string) (string, error) {
|
||||
return f(ctx, credential, service)
|
||||
}
|
||||
|
||||
// injection is one compiled credential@1 apiKey inject rule.
|
||||
type injection struct {
|
||||
service string
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package egress
|
||||
|
||||
import "context"
|
||||
|
||||
// ResolverFunc adapts a function to Resolver for tests.
|
||||
type ResolverFunc func(ctx context.Context, credential, service string) (string, error)
|
||||
|
||||
func (f ResolverFunc) Resolve(ctx context.Context, credential, service string) (string, error) {
|
||||
return f(ctx, credential, service)
|
||||
}
|
||||
Reference in new issue
Block a user