From 83808a8e177592a130e8d77a82bfb013808e1534 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 5 Oct 2020 14:36:24 -0700 Subject: [PATCH] delete sdk --- sdk/component/component.go | 173 -- sdk/component/config_var.go | 9 - sdk/component/configure.go | 114 - sdk/component/configure_test.go | 168 -- sdk/component/deployment.go | 42 - sdk/component/doc.go | 3 - sdk/component/id.go | 21 - sdk/component/logs.go | 33 - sdk/component/mocks/Authenticator.go | 42 - sdk/component/mocks/artifact.go | 26 - sdk/component/mocks/builder.go | 26 - sdk/component/mocks/config_platform.go | 42 - sdk/component/mocks/configurable.go | 33 - sdk/component/mocks/configurable_notify.go | 47 - sdk/component/mocks/deployment.go | 10 - sdk/component/mocks/destroyer.go | 26 - sdk/component/mocks/documented.go | 36 - sdk/component/mocks/exec_platform.go | 26 - sdk/component/mocks/log_platform.go | 26 - sdk/component/mocks/log_viewer.go | 39 - sdk/component/mocks/logs_platform.go | 26 - sdk/component/mocks/mocks.go | 55 - sdk/component/mocks/mocks_test.go | 37 - sdk/component/mocks/platform.go | 26 - sdk/component/mocks/platform_releaser.go | 26 - sdk/component/mocks/proto_marshaler.go | 29 - sdk/component/mocks/registry.go | 26 - sdk/component/mocks/release.go | 24 - sdk/component/mocks/release_manager.go | 26 - sdk/component/mocks/workspace_destroyer.go | 26 - sdk/component/proto.go | 92 - sdk/component/type_string.go | 32 - sdk/datadir/app.go | 21 - sdk/datadir/component.go | 7 - sdk/datadir/dir.go | 81 - sdk/datadir/doc.go | 18 - sdk/datadir/project.go | 38 - sdk/datadir/testing.go | 22 - sdk/docs/docs.go | 231 -- sdk/history/client.go | 32 - sdk/history/doc.go | 6 - sdk/history/mocks/client.go | 41 - sdk/internal-shared/README.md | 10 - sdk/internal-shared/pluginclient/client.go | 53 - sdk/internal-shared/protomappers/mappers.go | 257 -- .../protomappers/mappers_test.go | 60 - sdk/internal/funcspec/any_conv.go | 49 - sdk/internal/funcspec/args.go | 22 - sdk/internal/funcspec/func.go | 146 -- sdk/internal/funcspec/func_test.go | 120 - sdk/internal/funcspec/spec.go | 89 - sdk/internal/funcspec/spec_test.go | 137 -- sdk/internal/plugin/authenticator.go | 225 -- sdk/internal/plugin/base.go | 28 - sdk/internal/plugin/builder.go | 220 -- sdk/internal/plugin/builder_mix.go | 12 - sdk/internal/plugin/builder_test.go | 93 - sdk/internal/plugin/configure.go | 198 -- sdk/internal/plugin/configure_test.go | 44 - sdk/internal/plugin/destroyer.go | 132 -- sdk/internal/plugin/destroyer_workspace.go | 136 -- sdk/internal/plugin/dynamic_call.go | 94 - sdk/internal/plugin/error.go | 14 - sdk/internal/plugin/history/history.go | 104 - sdk/internal/plugin/history/lookup.go | 26 - sdk/internal/plugin/history/proto.go | 59 - sdk/internal/plugin/log_viewer.go | 86 - sdk/internal/plugin/logs.go | 157 -- sdk/internal/plugin/logs_test.go | 63 - sdk/internal/plugin/mapper.go | 183 -- sdk/internal/plugin/mapper_test.go | 74 - sdk/internal/plugin/platform.go | 458 ---- sdk/internal/plugin/platform_mix.go | 45 - sdk/internal/plugin/platform_test.go | 150 -- sdk/internal/plugin/plugin.go | 134 -- sdk/internal/plugin/plugin_test.go | 120 - sdk/internal/plugin/registry.go | 214 -- sdk/internal/plugin/registry_mix.go | 12 - sdk/internal/plugin/registry_test.go | 38 - sdk/internal/plugin/releaser.go | 276 --- sdk/internal/plugin/releaser_mix.go | 14 - sdk/internal/plugin/releaser_test.go | 51 - sdk/internal/plugin/terminal/ui.go | 779 ------ sdk/internal/pluginargs/pluginargs.go | 41 - sdk/internal/plugincomponent/artifact.go | 22 - sdk/internal/plugincomponent/deployment.go | 18 - sdk/internal/plugincomponent/doc.go | 3 - sdk/internal/plugincomponent/release.go | 20 - sdk/internal/stdio/stdio.go | 35 - sdk/internal/testproto/testproto.go | 5 - sdk/internal/testproto/testproto.pb.go | 282 --- sdk/internal/testproto/testproto.proto | 15 - sdk/main.go | 125 - sdk/proto/builder.pb.go | 701 ------ sdk/proto/builder.proto | 33 - sdk/proto/history.pb.go | 428 ---- sdk/proto/history.proto | 32 - sdk/proto/logs.pb.go | 571 ----- sdk/proto/logs.proto | 39 - sdk/proto/mapper.pb.go | 490 ---- sdk/proto/mapper.proto | 40 - sdk/proto/platform.pb.go | 1187 ---------- sdk/proto/platform.proto | 57 - sdk/proto/plugin.pb.go | 2102 ----------------- sdk/proto/plugin.proto | 210 -- sdk/proto/registry.pb.go | 684 ------ sdk/proto/registry.proto | 35 - sdk/proto/release.pb.go | 964 -------- sdk/proto/release.proto | 48 - sdk/proto/terminal.pb.go | 1680 ------------- sdk/proto/terminal.proto | 108 - sdk/terminal/basic.go | 185 -- sdk/terminal/display.go | 453 ---- sdk/terminal/doc.go | 7 - sdk/terminal/glint.go | 193 -- sdk/terminal/glint_status.go | 104 - sdk/terminal/glint_step_group.go | 172 -- sdk/terminal/glint_term.go | 181 -- sdk/terminal/input.go | 15 - sdk/terminal/noninteractive.go | 260 -- sdk/terminal/status.go | 158 -- sdk/terminal/step.go | 129 - sdk/terminal/table.go | 84 - sdk/terminal/ui.go | 205 -- sdk/terminal/ui_test.go | 84 - 125 files changed, 19251 deletions(-) delete mode 100644 sdk/component/component.go delete mode 100644 sdk/component/config_var.go delete mode 100644 sdk/component/configure.go delete mode 100644 sdk/component/configure_test.go delete mode 100644 sdk/component/deployment.go delete mode 100644 sdk/component/doc.go delete mode 100644 sdk/component/id.go delete mode 100644 sdk/component/logs.go delete mode 100644 sdk/component/mocks/Authenticator.go delete mode 100644 sdk/component/mocks/artifact.go delete mode 100644 sdk/component/mocks/builder.go delete mode 100644 sdk/component/mocks/config_platform.go delete mode 100644 sdk/component/mocks/configurable.go delete mode 100644 sdk/component/mocks/configurable_notify.go delete mode 100644 sdk/component/mocks/deployment.go delete mode 100644 sdk/component/mocks/destroyer.go delete mode 100644 sdk/component/mocks/documented.go delete mode 100644 sdk/component/mocks/exec_platform.go delete mode 100644 sdk/component/mocks/log_platform.go delete mode 100644 sdk/component/mocks/log_viewer.go delete mode 100644 sdk/component/mocks/logs_platform.go delete mode 100644 sdk/component/mocks/mocks.go delete mode 100644 sdk/component/mocks/mocks_test.go delete mode 100644 sdk/component/mocks/platform.go delete mode 100644 sdk/component/mocks/platform_releaser.go delete mode 100644 sdk/component/mocks/proto_marshaler.go delete mode 100644 sdk/component/mocks/registry.go delete mode 100644 sdk/component/mocks/release.go delete mode 100644 sdk/component/mocks/release_manager.go delete mode 100644 sdk/component/mocks/workspace_destroyer.go delete mode 100644 sdk/component/proto.go delete mode 100644 sdk/component/type_string.go delete mode 100644 sdk/datadir/app.go delete mode 100644 sdk/datadir/component.go delete mode 100644 sdk/datadir/dir.go delete mode 100644 sdk/datadir/doc.go delete mode 100644 sdk/datadir/project.go delete mode 100644 sdk/datadir/testing.go delete mode 100644 sdk/docs/docs.go delete mode 100644 sdk/history/client.go delete mode 100644 sdk/history/doc.go delete mode 100644 sdk/history/mocks/client.go delete mode 100644 sdk/internal-shared/README.md delete mode 100644 sdk/internal-shared/pluginclient/client.go delete mode 100644 sdk/internal-shared/protomappers/mappers.go delete mode 100644 sdk/internal-shared/protomappers/mappers_test.go delete mode 100644 sdk/internal/funcspec/any_conv.go delete mode 100644 sdk/internal/funcspec/args.go delete mode 100644 sdk/internal/funcspec/func.go delete mode 100644 sdk/internal/funcspec/func_test.go delete mode 100644 sdk/internal/funcspec/spec.go delete mode 100644 sdk/internal/funcspec/spec_test.go delete mode 100644 sdk/internal/plugin/authenticator.go delete mode 100644 sdk/internal/plugin/base.go delete mode 100644 sdk/internal/plugin/builder.go delete mode 100644 sdk/internal/plugin/builder_mix.go delete mode 100644 sdk/internal/plugin/builder_test.go delete mode 100644 sdk/internal/plugin/configure.go delete mode 100644 sdk/internal/plugin/configure_test.go delete mode 100644 sdk/internal/plugin/destroyer.go delete mode 100644 sdk/internal/plugin/destroyer_workspace.go delete mode 100644 sdk/internal/plugin/dynamic_call.go delete mode 100644 sdk/internal/plugin/error.go delete mode 100644 sdk/internal/plugin/history/history.go delete mode 100644 sdk/internal/plugin/history/lookup.go delete mode 100644 sdk/internal/plugin/history/proto.go delete mode 100644 sdk/internal/plugin/log_viewer.go delete mode 100644 sdk/internal/plugin/logs.go delete mode 100644 sdk/internal/plugin/logs_test.go delete mode 100644 sdk/internal/plugin/mapper.go delete mode 100644 sdk/internal/plugin/mapper_test.go delete mode 100644 sdk/internal/plugin/platform.go delete mode 100644 sdk/internal/plugin/platform_mix.go delete mode 100644 sdk/internal/plugin/platform_test.go delete mode 100644 sdk/internal/plugin/plugin.go delete mode 100644 sdk/internal/plugin/plugin_test.go delete mode 100644 sdk/internal/plugin/registry.go delete mode 100644 sdk/internal/plugin/registry_mix.go delete mode 100644 sdk/internal/plugin/registry_test.go delete mode 100644 sdk/internal/plugin/releaser.go delete mode 100644 sdk/internal/plugin/releaser_mix.go delete mode 100644 sdk/internal/plugin/releaser_test.go delete mode 100644 sdk/internal/plugin/terminal/ui.go delete mode 100644 sdk/internal/pluginargs/pluginargs.go delete mode 100644 sdk/internal/plugincomponent/artifact.go delete mode 100644 sdk/internal/plugincomponent/deployment.go delete mode 100644 sdk/internal/plugincomponent/doc.go delete mode 100644 sdk/internal/plugincomponent/release.go delete mode 100644 sdk/internal/stdio/stdio.go delete mode 100644 sdk/internal/testproto/testproto.go delete mode 100644 sdk/internal/testproto/testproto.pb.go delete mode 100644 sdk/internal/testproto/testproto.proto delete mode 100644 sdk/main.go delete mode 100644 sdk/proto/builder.pb.go delete mode 100644 sdk/proto/builder.proto delete mode 100644 sdk/proto/history.pb.go delete mode 100644 sdk/proto/history.proto delete mode 100644 sdk/proto/logs.pb.go delete mode 100644 sdk/proto/logs.proto delete mode 100644 sdk/proto/mapper.pb.go delete mode 100644 sdk/proto/mapper.proto delete mode 100644 sdk/proto/platform.pb.go delete mode 100644 sdk/proto/platform.proto delete mode 100644 sdk/proto/plugin.pb.go delete mode 100644 sdk/proto/plugin.proto delete mode 100644 sdk/proto/registry.pb.go delete mode 100644 sdk/proto/registry.proto delete mode 100644 sdk/proto/release.pb.go delete mode 100644 sdk/proto/release.proto delete mode 100644 sdk/proto/terminal.pb.go delete mode 100644 sdk/proto/terminal.proto delete mode 100644 sdk/terminal/basic.go delete mode 100644 sdk/terminal/display.go delete mode 100644 sdk/terminal/doc.go delete mode 100644 sdk/terminal/glint.go delete mode 100644 sdk/terminal/glint_status.go delete mode 100644 sdk/terminal/glint_step_group.go delete mode 100644 sdk/terminal/glint_term.go delete mode 100644 sdk/terminal/input.go delete mode 100644 sdk/terminal/noninteractive.go delete mode 100644 sdk/terminal/status.go delete mode 100644 sdk/terminal/step.go delete mode 100644 sdk/terminal/table.go delete mode 100644 sdk/terminal/ui.go delete mode 100644 sdk/terminal/ui_test.go diff --git a/sdk/component/component.go b/sdk/component/component.go deleted file mode 100644 index 8d39c322b69..00000000000 --- a/sdk/component/component.go +++ /dev/null @@ -1,173 +0,0 @@ -// Package component has the interfaces for all the components that -// can be implemented. A component is the broad term used to describe -// all builders, platforms, registries, etc. -// -// Many component interfaces have functions named `XFunc` where "X" is some -// operation and the return value is "interface{}". These functions should return -// a method handle to the function implementing that operation. This pattern is -// done so that we can support custom typed operations that take and return -// full rich types for an operation. We use a minimal dependency-injection -// framework (see internal/mapper) to call these functions. -package component - -//go:generate stringer -type=Type -linecomment -//go:generate mockery -all -case underscore - -// Type is an enum of all the types of components supported. -// This isn't used directly in this package but is used by other packages -// to reference the component types. -type Type uint - -const ( - InvalidType Type = iota // Invalid - BuilderType // Builder - RegistryType // Registry - PlatformType // Platform - ReleaseManagerType // ReleaseManager - LogPlatformType // LogPlatform - LogViewerType // LogViewer - AuthenticatorType // Authenticator - MapperType // Mapper - maxType -) - -// TypeMap is a mapping of Type to the nil pointer to the interface of that -// type. This can be used with libraries such as mapper. -var TypeMap = map[Type]interface{}{ - BuilderType: (*Builder)(nil), - RegistryType: (*Registry)(nil), - PlatformType: (*Platform)(nil), - ReleaseManagerType: (*ReleaseManager)(nil), - LogPlatformType: (*LogPlatform)(nil), - LogViewerType: (*LogViewer)(nil), - AuthenticatorType: (*Authenticator)(nil), -} - -// Builder is responsible for building an artifact from source. -type Builder interface { - // BuildFunc should return the method handle for the "build" operation. - // The build function has access to a *Source and should return an Artifact. - BuildFunc() interface{} -} - -// Registry is responsible for managing artifacts. -type Registry interface { - // PushFunc should return the method handle to the function for the "push" - // operation. The push function should take an artifact type and push it - // to the registry. - PushFunc() interface{} -} - -// Platform is responsible for deploying artifacts. -type Platform interface { - // DeployFunc should return the method handle for the "deploy" operation. - // The deploy function has access to the following and should use this - // as necessary to perform a deploy. - // - // artifact, artifact registry - // - DeployFunc() interface{} -} - -// PlatformReleaser is an optional interface that a Platform can implement -// to provide default Release functionality. This only takes effect if -// no release is configured. -type PlatformReleaser interface { - // DefaultReleaserFunc() should return a function that returns - // a ReleaseManger implementation. This ReleaseManager will NOT have - // any config so it must work by default. - DefaultReleaserFunc() interface{} -} - -// ReleaseManager is responsible for taking a deployment and making it -// "released" which means that traffic can now route to it. -type ReleaseManager interface { - // ReleaseFunc should return the method handle for the "release" operation. - ReleaseFunc() interface{} -} - -// Destroyer is responsible for destroying resources associated with this -// implementation. This can be implemented by all of the component types -// and will be called to perform cleanup on any created resources. -type Destroyer interface { - // DestroyFunc should return the method handle for the destroy operation. - DestroyFunc() interface{} -} - -// WorkspaceDestroyer is called when a workspace destroy operation is -// performed (typically via the "waypoint destroy" CLI). This can be implemented -// by any plugin. -type WorkspaceDestroyer interface { - // DestroyWorkspaceFunc is called when a workspace destroy operation is performed. - // - // This will only be called if that plugin had performed some operation - // previously on the workspace. This may be called multiple times so it should - // be idempotent. This will be called after all individual DestroyFuncs are - // complete. - DestroyWorkspaceFunc() interface{} -} - -// Authenticator is responsible for authenticating different types of plugins. -type Authenticator interface { - // AuthFunc should return the method for getting credentials for a - // plugin. This should return AuthResult. - AuthFunc() interface{} - - // ValidateAuthFunc should return the method for validating authentication - // credentials for the plugin - ValidateAuthFunc() interface{} -} - -// See Args.Source in the protobuf protocol. -type Source struct { - App string - Path string -} - -// AuthResult is the return value expected from Authenticator.AuthFunc. -type AuthResult struct { - // Authenticated when true means that the plugin should now be authenticated - // (given the other fields in this struct). If ValidateAuth is called, - // it should succeed. If this is false, the auth method may have printed - // help text or some other information, but it didn't authenticate. However, - // this is not an error. - Authenticated bool -} - -type LabelSet struct { - Labels map[string]string -} - -// JobInfo is available to plugins to get information about the context -// in which a job is executing. -type JobInfo struct { - // Id is the ID of the job that is executing this plugin operation. - // If this is empty then it means that the execution is happening - // outside of a job. - Id string - - // Local is true if the operation is running locally on a machine - // alongside the invocation. This can be used to determine if you can - // do things such as open browser windows, read user files, etc. - Local bool - - // Workspace is the workspace that this job is executing in. This should - // be used by plugins to properly isolate resources from each other. - Workspace string -} - -type Artifact interface { - // Labels are the labels to set. These will overwrite any conflicting - // labels on the value. Please namespace the labels you set. The recommended - // namespacing is using a URL structure, followed by a slash, and a key. - // For example: "plugin.example.com/key" as the key. The value can be - // any string. - Labels() map[string]string -} - -type Deployment interface{} - -type Release interface { - // URL is the URL to access this release. - URL() string -} diff --git a/sdk/component/config_var.go b/sdk/component/config_var.go deleted file mode 100644 index c88bc7a28d1..00000000000 --- a/sdk/component/config_var.go +++ /dev/null @@ -1,9 +0,0 @@ -package component - -import "errors" - -type ConfigVar struct { - Name, Value string -} - -var ErrNoSuchVariable = errors.New("no such variable exists") diff --git a/sdk/component/configure.go b/sdk/component/configure.go deleted file mode 100644 index 71954f57600..00000000000 --- a/sdk/component/configure.go +++ /dev/null @@ -1,114 +0,0 @@ -package component - -import ( - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/gohcl" - "github.com/hashicorp/waypoint/sdk/docs" -) - -// Configurable can be optionally implemented by any compontent to -// accept user configuration. -type Configurable interface { - // Config should return a pointer to an allocated configuration - // structure. This structure will be written to directly with the - // decoded configuration. If this returns nil, then it is as if - // Configurable was not implemented. - Config() (interface{}, error) -} - -// Documented can be optionally implemented by any component to -// return documentation about the component. -type Documented interface { - // Documentation() returns a completed docs.Documentation struct - // describing the components configuration. - Documentation() (*docs.Documentation, error) -} - -// ConfigurableNotify is an optional interface that can be implemented -// by any component to receive a notification that the configuration -// was decoded. -type ConfigurableNotify interface { - Configurable - - // ConfigSet is called with the value of the configuration after - // decoding is complete successfully. - ConfigSet(interface{}) error -} - -// Configure configures c with the provided configuration. -// -// If c does not implement Configurable AND body is non-empty, then it is -// an error. If body is empty in that case, it is not an error. -func Configure(c interface{}, body hcl.Body, ctx *hcl.EvalContext) hcl.Diagnostics { - if c, ok := c.(Configurable); ok { - // Get the configuration value - v, err := c.Config() - if err != nil { - return hcl.Diagnostics{ - &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: err.Error(), - Detail: "", - }, - } - } - - // If the configuration structure is nil then we behave as if the - // component is not configurable. - if v == nil { - return nil - } - - // Decode - if diag := gohcl.DecodeBody(body, ctx, v); len(diag) > 0 { - return diag - } - - // If decoding worked and we have a notification implementation, then - // notify with the value. - if cn, ok := c.(ConfigurableNotify); ok { - if err := cn.ConfigSet(v); err != nil { - return hcl.Diagnostics{ - &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: err.Error(), - Detail: "", - }, - } - } - } - - return nil - } - - // If c doesn't implement Configurable, then we parse the content with - // an empty schema which will error if there are any fields since its - // non-conformant to the schema. - _, diag := body.Content(&hcl.BodySchema{}) - return diag -} - -// Documentation returns the documentation for the given component. -// -// If c does not implement Documented, nil is returned. -func Documentation(c interface{}) (*docs.Documentation, error) { - if d, ok := c.(Documented); ok { - return d.Documentation() - } - - if c, ok := c.(Configurable); ok { - // Get the configuration value - v, err := c.Config() - - // If there is no configuration structure for this component, - // then there is really no documentation, so just return an empty - // docs structure. - if err != nil || v == nil { - return docs.New() - } - - return docs.New(docs.FromConfig(v)) - } - - return nil, nil -} diff --git a/sdk/component/configure_test.go b/sdk/component/configure_test.go deleted file mode 100644 index ba4c4523e76..00000000000 --- a/sdk/component/configure_test.go +++ /dev/null @@ -1,168 +0,0 @@ -package component - -import ( - "testing" - - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclparse" - "github.com/hashicorp/hcl/v2/hclsimple" - "github.com/stretchr/testify/require" -) - -func TestConfigure(t *testing.T) { - t.Run("valid config", func(t *testing.T) { - require := require.New(t) - - var c impl - src := `name = "foo"` - f, diag := hclparse.NewParser().ParseHCL([]byte(src), "test.hcl") - require.False(diag.HasErrors()) - - diag = Configure(&c, f.Body, nil) - require.False(diag.HasErrors()) - require.Equal(c.config.Name, "foo") - }) - - t.Run("invalid config", func(t *testing.T) { - require := require.New(t) - - var c impl - src := `` - f, diag := hclparse.NewParser().ParseHCL([]byte(src), "test.hcl") - require.False(diag.HasErrors()) - - diag = Configure(&c, f.Body, nil) - require.True(diag.HasErrors()) - require.Contains(diag.Error(), "is required") - }) - - t.Run("empty body", func(t *testing.T) { - require := require.New(t) - - var s struct { - Block struct { - Label string `hcl:",label"` - Body hcl.Body `hcl:",remain"` - } `hcl:"block,block"` - } - - src := `block "foo" {}` - require.NoError(hclsimple.Decode("test.hcl", []byte(src), nil, &s)) - - var c impl - diag := Configure(&c, s.Block.Body, nil) - require.True(diag.HasErrors()) - require.Contains(diag.Error(), "is required") - }) - - t.Run("nil interface", func(t *testing.T) { - require := require.New(t) - - var s struct { - Block struct { - Label string `hcl:",label"` - Body hcl.Body `hcl:",remain"` - } `hcl:"block,block"` - } - - src := `block "foo" {}` - require.NoError(hclsimple.Decode("test.hcl", []byte(src), nil, &s)) - - diag := Configure(nil, s.Block.Body, nil) - require.False(diag.HasErrors()) - }) - - t.Run("nil config struct", func(t *testing.T) { - require := require.New(t) - - var s struct { - Block struct { - Label string `hcl:",label"` - Body hcl.Body `hcl:",remain"` - } `hcl:"block,block"` - } - - src := `block "foo" {}` - require.NoError(hclsimple.Decode("test.hcl", []byte(src), nil, &s)) - - var c implNil - diag := Configure(&c, s.Block.Body, nil) - require.False(diag.HasErrors()) - }) -} - -func TestConfigure_nonImpl(t *testing.T) { - t.Run("empty body", func(t *testing.T) { - require := require.New(t) - - var s struct { - Block struct { - Label string `hcl:",label"` - Body hcl.Body `hcl:",remain"` - } `hcl:"block,block"` - } - - src := `block "foo" {}` - require.NoError(hclsimple.Decode("test.hcl", []byte(src), nil, &s)) - - var c struct{} - diag := Configure(&c, s.Block.Body, nil) - require.False(diag.HasErrors()) - }) - - t.Run("body", func(t *testing.T) { - require := require.New(t) - - src := `name = "foo"` - f, diag := hclparse.NewParser().ParseHCL([]byte(src), "test.hcl") - require.False(diag.HasErrors()) - - var c struct{} - diag = Configure(&c, f.Body, nil) - require.True(diag.HasErrors()) - t.Log(diag.Error()) - }) -} - -func TestConfigure_notify(t *testing.T) { - t.Run("valid config", func(t *testing.T) { - require := require.New(t) - - src := `name = "foo"` - f, diag := hclparse.NewParser().ParseHCL([]byte(src), "test.hcl") - require.False(diag.HasErrors()) - - var c implNotify - diag = Configure(&c, f.Body, nil) - require.False(diag.HasErrors()) - require.Equal(c.config.Name, "foo") - require.True(c.Notified) - }) -} - -type testConfig struct { - Name string `hcl:"name,attr"` -} - -type impl struct{ config testConfig } - -func (c *impl) Config() (interface{}, error) { return &c.config, nil } - -type implNil struct{} - -func (c *implNil) Config() (interface{}, error) { return nil, nil } - -type implNotify struct { - impl - Notified bool -} - -func (c *implNotify) ConfigSet(interface{}) error { - c.Notified = true - return nil -} - -var ( - _ Configurable = (*implNotify)(nil) - _ ConfigurableNotify = (*implNotify)(nil) -) diff --git a/sdk/component/deployment.go b/sdk/component/deployment.go deleted file mode 100644 index ab6b142ae3c..00000000000 --- a/sdk/component/deployment.go +++ /dev/null @@ -1,42 +0,0 @@ -package component - -// DeploymentConfig is the configuration for the behavior of a deployment. -// Platforms should take this argument and use the value to set the appropriate -// settings for the deployment -type DeploymentConfig struct { - Id string - ServerAddr string - ServerTls bool - ServerTlsSkipVerify bool - EntrypointInviteToken string -} - -// Env returns the environment variables that should be set for the entrypoint -// binary to have the proper configuration. -func (c *DeploymentConfig) Env() map[string]string { - results := map[string]string{ - "WAYPOINT_DEPLOYMENT_ID": c.Id, - } - - if c.ServerAddr == "" { - // If the server is disabled we set this env var. Note that having - // no address given also causes it to behave the same way. - results["WAYPOINT_SERVER_DISABLE"] = "1" - } else { - // Note the server address. - results["WAYPOINT_SERVER_ADDR"] = c.ServerAddr - if c.ServerTls { - results["WAYPOINT_SERVER_TLS"] = "1" - } - if c.ServerTlsSkipVerify { - results["WAYPOINT_SERVER_TLS_SKIP_VERIFY"] = "1" - } - - // Set our token if we have one - if c.EntrypointInviteToken != "" { - results["WAYPOINT_CEB_INVITE_TOKEN"] = c.EntrypointInviteToken - } - } - - return results -} diff --git a/sdk/component/doc.go b/sdk/component/doc.go deleted file mode 100644 index 3dc89df833e..00000000000 --- a/sdk/component/doc.go +++ /dev/null @@ -1,3 +0,0 @@ -// Package component exposes the component types supported and helpers around -// those types. -package component diff --git a/sdk/component/id.go b/sdk/component/id.go deleted file mode 100644 index 491887fc520..00000000000 --- a/sdk/component/id.go +++ /dev/null @@ -1,21 +0,0 @@ -package component - -import ( - "crypto/rand" - - "github.com/oklog/ulid" -) - -var ulidReader = ulid.Monotonic(rand.Reader, 1) - -// Id returns a unique Id that can be used for new values. This generates -// a ulid value but the ID itself should be an internal detail. An error will -// be returned if the ID could be generated. -func Id() (string, error) { - id, err := ulid.New(ulid.Now(), ulidReader) - if err != nil { - return "", err - } - - return id.String(), nil -} diff --git a/sdk/component/logs.go b/sdk/component/logs.go deleted file mode 100644 index ea09533d5d3..00000000000 --- a/sdk/component/logs.go +++ /dev/null @@ -1,33 +0,0 @@ -package component - -import ( - "context" - "encoding/base32" - "time" -) - -// LogPlatform is responsible for reading the logs for a deployment. -// This doesn't need to be the same as the Platform but a Platform can also -// implement this interface to natively provide logs. -type LogPlatform interface { - // LogsFunc should return an implementation of LogViewer. - LogsFunc() interface{} -} - -// LogViewer returns batches of log lines. This is expected to be returned -// by a LogPlatform implementation. -type LogViewer interface { - // NextBatch is called to return the next batch of logs. This is expected - // to block if there are no logs available. The context passed in will be - // cancelled if the logs viewer is interrupted. - NextLogBatch(ctx context.Context) ([]LogEvent, error) -} - -// LogEvent represents a single log entry. -type LogEvent struct { - Partition string - Timestamp time.Time - Message string -} - -var encoding = base32.NewEncoding("abcdefghijklmnopqrstuvwxyz234567") diff --git a/sdk/component/mocks/Authenticator.go b/sdk/component/mocks/Authenticator.go deleted file mode 100644 index e42dd710fed..00000000000 --- a/sdk/component/mocks/Authenticator.go +++ /dev/null @@ -1,42 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// Authenticator is an autogenerated mock type for the Authenticator type -type Authenticator struct { - mock.Mock -} - -// AuthFunc provides a mock function with given fields: -func (_m *Authenticator) AuthFunc() interface{} { - ret := _m.Called() - - var r0 interface{} - if rf, ok := ret.Get(0).(func() interface{}); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(interface{}) - } - } - - return r0 -} - -// ValidateAuthFunc provides a mock function with given fields: -func (_m *Authenticator) ValidateAuthFunc() interface{} { - ret := _m.Called() - - var r0 interface{} - if rf, ok := ret.Get(0).(func() interface{}); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(interface{}) - } - } - - return r0 -} diff --git a/sdk/component/mocks/artifact.go b/sdk/component/mocks/artifact.go deleted file mode 100644 index 04165bab980..00000000000 --- a/sdk/component/mocks/artifact.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// Artifact is an autogenerated mock type for the Artifact type -type Artifact struct { - mock.Mock -} - -// Labels provides a mock function with given fields: -func (_m *Artifact) Labels() map[string]string { - ret := _m.Called() - - var r0 map[string]string - if rf, ok := ret.Get(0).(func() map[string]string); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(map[string]string) - } - } - - return r0 -} diff --git a/sdk/component/mocks/builder.go b/sdk/component/mocks/builder.go deleted file mode 100644 index 6d48b5ef38e..00000000000 --- a/sdk/component/mocks/builder.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// Builder is an autogenerated mock type for the Builder type -type Builder struct { - mock.Mock -} - -// BuildFunc provides a mock function with given fields: -func (_m *Builder) BuildFunc() interface{} { - ret := _m.Called() - - var r0 interface{} - if rf, ok := ret.Get(0).(func() interface{}); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(interface{}) - } - } - - return r0 -} diff --git a/sdk/component/mocks/config_platform.go b/sdk/component/mocks/config_platform.go deleted file mode 100644 index 11b2d709143..00000000000 --- a/sdk/component/mocks/config_platform.go +++ /dev/null @@ -1,42 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// ConfigPlatform is an autogenerated mock type for the ConfigPlatform type -type ConfigPlatform struct { - mock.Mock -} - -// ConfigGetFunc provides a mock function with given fields: -func (_m *ConfigPlatform) ConfigGetFunc() interface{} { - ret := _m.Called() - - var r0 interface{} - if rf, ok := ret.Get(0).(func() interface{}); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(interface{}) - } - } - - return r0 -} - -// ConfigSetFunc provides a mock function with given fields: -func (_m *ConfigPlatform) ConfigSetFunc() interface{} { - ret := _m.Called() - - var r0 interface{} - if rf, ok := ret.Get(0).(func() interface{}); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(interface{}) - } - } - - return r0 -} diff --git a/sdk/component/mocks/configurable.go b/sdk/component/mocks/configurable.go deleted file mode 100644 index e9c4b0adc22..00000000000 --- a/sdk/component/mocks/configurable.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// Configurable is an autogenerated mock type for the Configurable type -type Configurable struct { - mock.Mock -} - -// Config provides a mock function with given fields: -func (_m *Configurable) Config() (interface{}, error) { - ret := _m.Called() - - var r0 interface{} - if rf, ok := ret.Get(0).(func() interface{}); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(interface{}) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} diff --git a/sdk/component/mocks/configurable_notify.go b/sdk/component/mocks/configurable_notify.go deleted file mode 100644 index f4349d26e17..00000000000 --- a/sdk/component/mocks/configurable_notify.go +++ /dev/null @@ -1,47 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// ConfigurableNotify is an autogenerated mock type for the ConfigurableNotify type -type ConfigurableNotify struct { - mock.Mock -} - -// Config provides a mock function with given fields: -func (_m *ConfigurableNotify) Config() (interface{}, error) { - ret := _m.Called() - - var r0 interface{} - if rf, ok := ret.Get(0).(func() interface{}); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(interface{}) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ConfigSet provides a mock function with given fields: _a0 -func (_m *ConfigurableNotify) ConfigSet(_a0 interface{}) error { - ret := _m.Called(_a0) - - var r0 error - if rf, ok := ret.Get(0).(func(interface{}) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } - - return r0 -} diff --git a/sdk/component/mocks/deployment.go b/sdk/component/mocks/deployment.go deleted file mode 100644 index 6cb824b4472..00000000000 --- a/sdk/component/mocks/deployment.go +++ /dev/null @@ -1,10 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// Deployment is an autogenerated mock type for the Deployment type -type Deployment struct { - mock.Mock -} diff --git a/sdk/component/mocks/destroyer.go b/sdk/component/mocks/destroyer.go deleted file mode 100644 index 4d3019c5b18..00000000000 --- a/sdk/component/mocks/destroyer.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// Destroyer is an autogenerated mock type for the Destroyer type -type Destroyer struct { - mock.Mock -} - -// DestroyFunc provides a mock function with given fields: -func (_m *Destroyer) DestroyFunc() interface{} { - ret := _m.Called() - - var r0 interface{} - if rf, ok := ret.Get(0).(func() interface{}); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(interface{}) - } - } - - return r0 -} diff --git a/sdk/component/mocks/documented.go b/sdk/component/mocks/documented.go deleted file mode 100644 index 64c12d8f884..00000000000 --- a/sdk/component/mocks/documented.go +++ /dev/null @@ -1,36 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import ( - docs "github.com/hashicorp/waypoint/sdk/docs" - mock "github.com/stretchr/testify/mock" -) - -// Documented is an autogenerated mock type for the Documented type -type Documented struct { - mock.Mock -} - -// Documentation provides a mock function with given fields: -func (_m *Documented) Documentation() (*docs.Documentation, error) { - ret := _m.Called() - - var r0 *docs.Documentation - if rf, ok := ret.Get(0).(func() *docs.Documentation); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*docs.Documentation) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} diff --git a/sdk/component/mocks/exec_platform.go b/sdk/component/mocks/exec_platform.go deleted file mode 100644 index 8da4cb26898..00000000000 --- a/sdk/component/mocks/exec_platform.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// ExecPlatform is an autogenerated mock type for the ExecPlatform type -type ExecPlatform struct { - mock.Mock -} - -// ExecFunc provides a mock function with given fields: -func (_m *ExecPlatform) ExecFunc() interface{} { - ret := _m.Called() - - var r0 interface{} - if rf, ok := ret.Get(0).(func() interface{}); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(interface{}) - } - } - - return r0 -} diff --git a/sdk/component/mocks/log_platform.go b/sdk/component/mocks/log_platform.go deleted file mode 100644 index 0a7a13bdbbc..00000000000 --- a/sdk/component/mocks/log_platform.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// LogPlatform is an autogenerated mock type for the LogPlatform type -type LogPlatform struct { - mock.Mock -} - -// LogsFunc provides a mock function with given fields: -func (_m *LogPlatform) LogsFunc() interface{} { - ret := _m.Called() - - var r0 interface{} - if rf, ok := ret.Get(0).(func() interface{}); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(interface{}) - } - } - - return r0 -} diff --git a/sdk/component/mocks/log_viewer.go b/sdk/component/mocks/log_viewer.go deleted file mode 100644 index 7f638ee269b..00000000000 --- a/sdk/component/mocks/log_viewer.go +++ /dev/null @@ -1,39 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import ( - context "context" - - component "github.com/hashicorp/waypoint/sdk/component" - - mock "github.com/stretchr/testify/mock" -) - -// LogViewer is an autogenerated mock type for the LogViewer type -type LogViewer struct { - mock.Mock -} - -// NextLogBatch provides a mock function with given fields: ctx -func (_m *LogViewer) NextLogBatch(ctx context.Context) ([]component.LogEvent, error) { - ret := _m.Called(ctx) - - var r0 []component.LogEvent - if rf, ok := ret.Get(0).(func(context.Context) []component.LogEvent); ok { - r0 = rf(ctx) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]component.LogEvent) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} diff --git a/sdk/component/mocks/logs_platform.go b/sdk/component/mocks/logs_platform.go deleted file mode 100644 index 5762ae08f19..00000000000 --- a/sdk/component/mocks/logs_platform.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// LogsPlatform is an autogenerated mock type for the LogsPlatform type -type LogsPlatform struct { - mock.Mock -} - -// LogsFunc provides a mock function with given fields: -func (_m *LogsPlatform) LogsFunc() interface{} { - ret := _m.Called() - - var r0 interface{} - if rf, ok := ret.Get(0).(func() interface{}); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(interface{}) - } - } - - return r0 -} diff --git a/sdk/component/mocks/mocks.go b/sdk/component/mocks/mocks.go deleted file mode 100644 index 442120cbdd0..00000000000 --- a/sdk/component/mocks/mocks.go +++ /dev/null @@ -1,55 +0,0 @@ -package mocks - -import ( - "reflect" - - "github.com/stretchr/testify/mock" - - "github.com/hashicorp/waypoint/sdk/component" -) - -// ForType returns an implementation of the given type that supports mocking. -func ForType(t component.Type) interface{} { - // Note that the tests in mocks_test.go verify that we support all types - switch t { - case component.BuilderType: - return &Builder{} - - case component.RegistryType: - return &Registry{} - - case component.PlatformType: - return &Platform{} - - case component.LogPlatformType: - return &LogPlatform{} - - case component.LogViewerType: - return &LogViewer{} - - case component.ReleaseManagerType: - return &ReleaseManager{} - - case component.AuthenticatorType: - return &Authenticator{} - - default: - return nil - } -} - -// Mock returns the Mock field for the given interface. The interface value -// should be one of the mocks in this package. This will panic if an incorrect -// value is given, error checking is not done. -func Mock(v interface{}) *mock.Mock { - value := reflect.ValueOf(v) - if value.Kind() == reflect.Interface { - value = reflect.Indirect(value) - } - if value.Kind() == reflect.Ptr { - value = value.Elem() - } - - field := value.FieldByName("Mock") - return field.Addr().Interface().(*mock.Mock) -} diff --git a/sdk/component/mocks/mocks_test.go b/sdk/component/mocks/mocks_test.go deleted file mode 100644 index 4cfd52d0db4..00000000000 --- a/sdk/component/mocks/mocks_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package mocks - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/hashicorp/waypoint/sdk/component" -) - -func TestForType(t *testing.T) { - for typ := range component.TypeMap { - t.Run(typ.String(), func(t *testing.T) { - require.NotNil(t, ForType(typ)) - }) - } -} - -func TestMock_typed(t *testing.T) { - require := require.New(t) - - b := &Builder{} - m := Mock(b) - require.NotNil(m) - require.Equal(m, &b.Mock) -} - -func TestMock_allTypes(t *testing.T) { - for typ := range component.TypeMap { - t.Run(typ.String(), func(t *testing.T) { - require := require.New(t) - v := ForType(typ) - m := Mock(v) - require.NotNil(m) - }) - } -} diff --git a/sdk/component/mocks/platform.go b/sdk/component/mocks/platform.go deleted file mode 100644 index dabe87558e1..00000000000 --- a/sdk/component/mocks/platform.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// Platform is an autogenerated mock type for the Platform type -type Platform struct { - mock.Mock -} - -// DeployFunc provides a mock function with given fields: -func (_m *Platform) DeployFunc() interface{} { - ret := _m.Called() - - var r0 interface{} - if rf, ok := ret.Get(0).(func() interface{}); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(interface{}) - } - } - - return r0 -} diff --git a/sdk/component/mocks/platform_releaser.go b/sdk/component/mocks/platform_releaser.go deleted file mode 100644 index a959e70712d..00000000000 --- a/sdk/component/mocks/platform_releaser.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// PlatformReleaser is an autogenerated mock type for the PlatformReleaser type -type PlatformReleaser struct { - mock.Mock -} - -// DefaultReleaserFunc provides a mock function with given fields: -func (_m *PlatformReleaser) DefaultReleaserFunc() interface{} { - ret := _m.Called() - - var r0 interface{} - if rf, ok := ret.Get(0).(func() interface{}); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(interface{}) - } - } - - return r0 -} diff --git a/sdk/component/mocks/proto_marshaler.go b/sdk/component/mocks/proto_marshaler.go deleted file mode 100644 index b5166d5818b..00000000000 --- a/sdk/component/mocks/proto_marshaler.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import ( - mock "github.com/stretchr/testify/mock" - protoiface "google.golang.org/protobuf/runtime/protoiface" -) - -// ProtoMarshaler is an autogenerated mock type for the ProtoMarshaler type -type ProtoMarshaler struct { - mock.Mock -} - -// Proto provides a mock function with given fields: -func (_m *ProtoMarshaler) Proto() protoiface.MessageV1 { - ret := _m.Called() - - var r0 protoiface.MessageV1 - if rf, ok := ret.Get(0).(func() protoiface.MessageV1); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(protoiface.MessageV1) - } - } - - return r0 -} diff --git a/sdk/component/mocks/registry.go b/sdk/component/mocks/registry.go deleted file mode 100644 index d625fd2d0af..00000000000 --- a/sdk/component/mocks/registry.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// Registry is an autogenerated mock type for the Registry type -type Registry struct { - mock.Mock -} - -// PushFunc provides a mock function with given fields: -func (_m *Registry) PushFunc() interface{} { - ret := _m.Called() - - var r0 interface{} - if rf, ok := ret.Get(0).(func() interface{}); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(interface{}) - } - } - - return r0 -} diff --git a/sdk/component/mocks/release.go b/sdk/component/mocks/release.go deleted file mode 100644 index 31335434199..00000000000 --- a/sdk/component/mocks/release.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// Release is an autogenerated mock type for the Release type -type Release struct { - mock.Mock -} - -// URL provides a mock function with given fields: -func (_m *Release) URL() string { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} diff --git a/sdk/component/mocks/release_manager.go b/sdk/component/mocks/release_manager.go deleted file mode 100644 index ad1e2b46b3c..00000000000 --- a/sdk/component/mocks/release_manager.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// ReleaseManager is an autogenerated mock type for the ReleaseManager type -type ReleaseManager struct { - mock.Mock -} - -// ReleaseFunc provides a mock function with given fields: -func (_m *ReleaseManager) ReleaseFunc() interface{} { - ret := _m.Called() - - var r0 interface{} - if rf, ok := ret.Get(0).(func() interface{}); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(interface{}) - } - } - - return r0 -} diff --git a/sdk/component/mocks/workspace_destroyer.go b/sdk/component/mocks/workspace_destroyer.go deleted file mode 100644 index 2a2fd38bf92..00000000000 --- a/sdk/component/mocks/workspace_destroyer.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// WorkspaceDestroyer is an autogenerated mock type for the WorkspaceDestroyer type -type WorkspaceDestroyer struct { - mock.Mock -} - -// DestroyWorkspaceFunc provides a mock function with given fields: -func (_m *WorkspaceDestroyer) DestroyWorkspaceFunc() interface{} { - ret := _m.Called() - - var r0 interface{} - if rf, ok := ret.Get(0).(func() interface{}); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(interface{}) - } - } - - return r0 -} diff --git a/sdk/component/proto.go b/sdk/component/proto.go deleted file mode 100644 index 33ae8a028c0..00000000000 --- a/sdk/component/proto.go +++ /dev/null @@ -1,92 +0,0 @@ -package component - -import ( - "reflect" - - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes" - "github.com/golang/protobuf/ptypes/any" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -// ProtoMarshaler is the interface required by objects that must support -// protobuf marshaling. This expects the object to go to a proto.Message -// which is converted to a proto Any value[1]. The plugin is expected to -// register a proto type that can decode this Any value. -// -// This enables the project to encode intermediate objects (such as artifacts) -// and store them in a database. -// -// [1]: https://developers.google.com/protocol-buffers/docs/proto3#any -type ProtoMarshaler interface { - // Proto returns a proto.Message of this structure. This may also return - // a proto Any value and it will not be re-wrapped with Any. - Proto() proto.Message -} - -// ProtoAny returns an *any.Any for the given ProtoMarshaler object. -func ProtoAny(m interface{}) (*any.Any, error) { - msg, ok := m.(proto.Message) - - // If it isn't a message directly, we accept marshalers - if !ok { - pm, ok := m.(ProtoMarshaler) - if !ok { - return nil, nil - } - - msg = pm.Proto() - } - - // If the message is already an Any, then we're done - if result, ok := msg.(*any.Any); ok { - return result, nil - } - - // Marshal it - return ptypes.MarshalAny(msg) -} - -// ProtoAny returns []*any.Any for the given input slice by encoding -// each result into a proto value. -func ProtoAnySlice(m interface{}) ([]*any.Any, error) { - val := reflect.ValueOf(m) - result := make([]*any.Any, val.Len()) - for i := 0; i < val.Len(); i++ { - var err error - result[i], err = ProtoAny(val.Index(i).Interface()) - if err != nil { - return nil, err - } - } - - return result, nil -} - -// ProtoAnyUnmarshal attempts to unmarshal a ProtoMarshler implementation -// to another type. This can be used to get more concrete data out of a -// generic component. -func ProtoAnyUnmarshal(m interface{}, out proto.Message) error { - msg, ok := m.(proto.Message) - - // If it isn't a message directly, we accept marshalers - if !ok { - pm, ok := m.(ProtoMarshaler) - if !ok { - return status.Errorf(codes.FailedPrecondition, - "expected value to be a proto message, got %T", - m) - } - - msg = pm.Proto() - } - - result, ok := msg.(*any.Any) - if !ok { - return status.Errorf(codes.FailedPrecondition, "expected *any.Any, got %T", msg) - } - - // Unmarshal - return ptypes.UnmarshalAny(result, out) -} diff --git a/sdk/component/type_string.go b/sdk/component/type_string.go deleted file mode 100644 index 8690f4c8152..00000000000 --- a/sdk/component/type_string.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code generated by "stringer -type=Type -linecomment"; DO NOT EDIT. - -package component - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[InvalidType-0] - _ = x[BuilderType-1] - _ = x[RegistryType-2] - _ = x[PlatformType-3] - _ = x[ReleaseManagerType-4] - _ = x[LogPlatformType-5] - _ = x[LogViewerType-6] - _ = x[AuthenticatorType-7] - _ = x[MapperType-8] - _ = x[maxType-9] -} - -const _Type_name = "InvalidBuilderRegistryPlatformReleaseManagerLogPlatformLogViewerAuthenticatorMappermaxType" - -var _Type_index = [...]uint8{0, 7, 14, 22, 30, 44, 55, 64, 77, 83, 90} - -func (i Type) String() string { - if i >= Type(len(_Type_index)-1) { - return "Type(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _Type_name[_Type_index[i]:_Type_index[i+1]] -} diff --git a/sdk/datadir/app.go b/sdk/datadir/app.go deleted file mode 100644 index 3e8309e557f..00000000000 --- a/sdk/datadir/app.go +++ /dev/null @@ -1,21 +0,0 @@ -package datadir - -import ( - "path/filepath" -) - -// App is an implementation of Dir that encapsulates the directories for a -// single app. -type App struct { - Dir -} - -// Component returns a Dir implementation scoped to a specific component. -func (d *App) Component(typ, name string) (*Component, error) { - dir, err := NewScopedDir(d, filepath.Join("component", typ, name)) - if err != nil { - return nil, err - } - - return &Component{Dir: dir}, nil -} diff --git a/sdk/datadir/component.go b/sdk/datadir/component.go deleted file mode 100644 index 9971858fe57..00000000000 --- a/sdk/datadir/component.go +++ /dev/null @@ -1,7 +0,0 @@ -package datadir - -// Component is an implementation of Dir that encapsulates the directories for a -// single app. -type Component struct { - Dir -} diff --git a/sdk/datadir/dir.go b/sdk/datadir/dir.go deleted file mode 100644 index e7f51bf7053..00000000000 --- a/sdk/datadir/dir.go +++ /dev/null @@ -1,81 +0,0 @@ -package datadir - -import ( - "os" - "path/filepath" -) - -// TODO(mitchellh): we use deeply nested directories here which isn't -// going to work on Windows (due to MAX_PATH). We should have an alternate -// implementation for Windows. - -// TODO(mitchellh): tests! like any tests - -// Dir is the interface implemented so that consumers can store data -// locally in a consistent way. -type Dir interface { - // CacheDir returns the path to a folder that can be used for - // cache data. This directory may not be empty if a previous run - // stored data, but it may also be emptied at any time between runs. - CacheDir() string - - // DataDir returns the path to a folder that can be used for data - // that is persisted between runs. - DataDir() string -} - -// basicDir implements Dir in the simplest possible way. -type basicDir struct { - cacheDir string - dataDir string -} - -// CacheDir impl Dir -func (d *basicDir) CacheDir() string { return d.cacheDir } - -// DataDir impl Dir -func (d *basicDir) DataDir() string { return d.dataDir } - -// newRootDir creates a basicDir for the root directory which puts -// data at /cache, etc. -func newRootDir(path string) (Dir, error) { - if err := os.MkdirAll(path, 0755); err != nil { - return nil, err - } - - cacheDir := filepath.Join(path, "cache") - dataDir := filepath.Join(path, "data") - if err := os.MkdirAll(cacheDir, 0755); err != nil { - return nil, err - } - if err := os.MkdirAll(dataDir, 0755); err != nil { - return nil, err - } - - return &basicDir{cacheDir: cacheDir, dataDir: dataDir}, nil -} - -// NewBasicDir creates a Dir implementation with a manually specified -// set of directories. -func NewBasicDir(cacheDir, dataDir string) Dir { - return &basicDir{cacheDir: cacheDir, dataDir: dataDir} -} - -// NewScopedDir creates a ScopedDir for the given parent at the relative -// child path of path. The caller should take care that multiple scoped -// dirs with overlapping paths are not created, since they could still -// collide. -func NewScopedDir(parent Dir, path string) (Dir, error) { - cacheDir := filepath.Join(parent.CacheDir(), path) - dataDir := filepath.Join(parent.DataDir(), path) - if err := os.MkdirAll(cacheDir, 0755); err != nil { - return nil, err - } - if err := os.MkdirAll(dataDir, 0755); err != nil { - return nil, err - } - - return &basicDir{cacheDir: cacheDir, dataDir: dataDir}, nil -} - -var _ Dir = (*basicDir)(nil) diff --git a/sdk/datadir/doc.go b/sdk/datadir/doc.go deleted file mode 100644 index ece655c29e5..00000000000 --- a/sdk/datadir/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -// Package datadir manages the data directories. This includes persisted -// data such as state as well as ephemeral data such as cache and runtime -// files. -// -// This package is aware of the data model presented and provides easy -// helpers to create app-specific, component-specific, etc. data directories. -// -// This package is the result of lessons learned from reimplementing -// "data directories" for projects such as Vagrant and Terraform. Those -// projects managed a list of directories directly in the CLI, forcing -// a lot of code to be aware of paths and making it hard to implement -// operations on those paths such as pruning, migration, compression, etc. -// As an evolution, we create the "datadir" package which has deep knowledge -// of the software data model and consumers interact using higher level APIs -// rather than direct filesystem manipulation. This gives us more room to -// introduce improvements in the future that broadly impact the application -// without having to make those changes in many places. -package datadir diff --git a/sdk/datadir/project.go b/sdk/datadir/project.go deleted file mode 100644 index c8f67ffc33c..00000000000 --- a/sdk/datadir/project.go +++ /dev/null @@ -1,38 +0,0 @@ -package datadir - -import ( - "path/filepath" -) - -// Project is an implementation of Dir that encapsulates the directory -// for an entire project, including multiple apps. -// -// The paths returned by the Dir interface functions will be project-global. -// This means that the data is shared by all applications in the project. -type Project struct { - Dir -} - -// NewProject creates the directory structure for a project. This will -// create the physical directories on disk if they do not already exist. -func NewProject(path string) (*Project, error) { - dir, err := newRootDir(path) - if err != nil { - return nil, err - } - - return &Project{Dir: dir}, nil -} - -// App returns the Dir implementation scoped to a specific app. -func (p *Project) App(name string) (*App, error) { - dir, err := NewScopedDir(p, filepath.Join("app", name)) - if err != nil { - return nil, err - } - - return &App{Dir: dir}, nil -} - -// Assert implementation -var _ Dir = (*Project)(nil) diff --git a/sdk/datadir/testing.go b/sdk/datadir/testing.go deleted file mode 100644 index 78dd3bf9396..00000000000 --- a/sdk/datadir/testing.go +++ /dev/null @@ -1,22 +0,0 @@ -package datadir - -import ( - "io/ioutil" - "os" - - "github.com/mitchellh/go-testing-interface" - "github.com/stretchr/testify/require" -) - -// TestDir returns a Dir for testing. -func TestDir(t testing.T) (Dir, func()) { - t.Helper() - - td, err := ioutil.TempDir("", "datadir-test") - require.NoError(t, err) - - dir, err := newRootDir(td) - require.NoError(t, err) - - return dir, func() { os.RemoveAll(td) } -} diff --git a/sdk/docs/docs.go b/sdk/docs/docs.go deleted file mode 100644 index 9fe517b80dd..00000000000 --- a/sdk/docs/docs.go +++ /dev/null @@ -1,231 +0,0 @@ -package docs - -import ( - "fmt" - "reflect" - "sort" - "strings" -) - -type Details struct { - Description string - Example string - - Input string - Output string - - Mappers []Mapper -} - -type Mapper struct { - Input string - Output string - Description string -} - -type FieldDocs struct { - Field string - Type string - Synopsis string - Summary string - - Optional bool - Default string - EnvVar string -} - -type Documentation struct { - description string - example string - input string - output string - fields map[string]*FieldDocs - mappers []Mapper -} - -type Option func(*Documentation) error - -func New(opts ...Option) (*Documentation, error) { - var d Documentation - - d.fields = make(map[string]*FieldDocs) - - for _, opt := range opts { - err := opt(&d) - if err != nil { - return nil, err - } - } - - return &d, nil -} - -func FromConfig(v interface{}) Option { - return func(d *Documentation) error { - rv := reflect.ValueOf(v).Elem() - if rv.Kind() != reflect.Struct { - return fmt.Errorf("invalid config type, must be struct") - } - - t := rv.Type() - - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - name, ok := f.Tag.Lookup("hcl") - if !ok { - return fmt.Errorf("missing hcl tag on field: %s", f.Name) - } - - parts := strings.Split(name, ",") - - if parts[0] == "" { - continue - } - - field := &FieldDocs{ - Field: parts[0], - Type: f.Type.String(), - } - - for _, p := range parts[1:] { - if p == "optional" { - field.Optional = true - } - } - - d.fields[parts[0]] = field - } - - return nil - } -} - -func formatHelp(lines ...string) string { - var sb strings.Builder - - for i, line := range lines { - if i > 0 { - sb.WriteByte('\n') - } - - sb.WriteString(strings.TrimSpace(line)) - } - - return sb.String() -} - -type ( - SummaryString string - Default string - EnvVar string -) - -type DocOption interface { - docOption() bool -} - -func (o SummaryString) docOption() bool { return true } -func (o Default) docOption() bool { return true } -func (o EnvVar) docOption() bool { return true } - -func Summary(in ...string) SummaryString { - var sb strings.Builder - - for i, str := range in { - if str == "" { - sb.WriteByte('\n') - } - - if i > 0 { - sb.WriteByte(' ') - } - - sb.WriteString(strings.TrimSpace(str)) - } - - return SummaryString(sb.String()) - -} - -func (d *Documentation) Example(x string) { - d.example = x -} - -func (d *Documentation) Description(x string) { - d.description = x -} - -func (d *Documentation) Input(x string) { - d.input = x -} - -func (d *Documentation) Output(x string) { - d.output = x -} - -func (d *Documentation) AddMapper(input, output, description string) { - d.mappers = append(d.mappers, Mapper{ - Input: input, - Output: output, - Description: description, - }) -} - -func (d *Documentation) SetField(name, synposis string, opts ...DocOption) error { - field, ok := d.fields[name] - if !ok { - field = &FieldDocs{ - Field: name, - Synopsis: synposis, - } - d.fields[name] = field - } else { - field.Synopsis = synposis - } - - for _, o := range opts { - switch v := o.(type) { - case SummaryString: - field.Summary = string(v) - case Default: - field.Default = string(v) - case EnvVar: - field.EnvVar = string(v) - } - } - - return nil -} - -func (d *Documentation) OverrideField(f *FieldDocs) error { - d.fields[f.Field] = f - return nil -} - -func (d *Documentation) Details() *Details { - return &Details{ - Example: d.example, - Description: d.description, - Input: d.input, - Output: d.output, - Mappers: d.mappers, - } -} - -func (d *Documentation) Fields() []*FieldDocs { - var keys []string - - for k := range d.fields { - keys = append(keys, k) - } - - sort.Strings(keys) - - var fields []*FieldDocs - - for _, k := range keys { - fields = append(fields, d.fields[k]) - } - - return fields -} diff --git a/sdk/history/client.go b/sdk/history/client.go deleted file mode 100644 index 468582753b6..00000000000 --- a/sdk/history/client.go +++ /dev/null @@ -1,32 +0,0 @@ -package history - -import ( - "context" - - "github.com/hashicorp/waypoint/sdk/component" -) - -// Client is the client to access historical information. Component -// plugins can add this as an argument to get access to an implementation. -type Client interface { - // Deployments looks up past deployments. - Deployments(context.Context, *Lookup) ([]component.Deployment, error) -} - -// Lookup is the lookup configuration used by the history client. -type Lookup struct { - // Limit is the number of results to return - Limit int - - // FilterStatus allows filtering by as specific status. - FilterStatus FilterStatus -} - -// FilterStatus is a value for what status to look for in a lookup. -type FilterStatus uint - -const ( - StatusInvalid FilterStatus = iota // invalid - StatusSuccess // success - StatusError // error -) diff --git a/sdk/history/doc.go b/sdk/history/doc.go deleted file mode 100644 index 17468c766e0..00000000000 --- a/sdk/history/doc.go +++ /dev/null @@ -1,6 +0,0 @@ -// Package history provides an interface for components to query historical -// actions. An example use case is for a platorm to look up historical -// deployments it may use determine whether it is creating or updating. -package history - -//go:generate mockery -all -case underscore diff --git a/sdk/history/mocks/client.go b/sdk/history/mocks/client.go deleted file mode 100644 index ca6babc35be..00000000000 --- a/sdk/history/mocks/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. - -package mocks - -import ( - context "context" - - component "github.com/hashicorp/waypoint/sdk/component" - - history "github.com/hashicorp/waypoint/sdk/history" - - mock "github.com/stretchr/testify/mock" -) - -// Client is an autogenerated mock type for the Client type -type Client struct { - mock.Mock -} - -// Deployments provides a mock function with given fields: _a0, _a1 -func (_m *Client) Deployments(_a0 context.Context, _a1 *history.Lookup) ([]component.Deployment, error) { - ret := _m.Called(_a0, _a1) - - var r0 []component.Deployment - if rf, ok := ret.Get(0).(func(context.Context, *history.Lookup) []component.Deployment); ok { - r0 = rf(_a0, _a1) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]component.Deployment) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *history.Lookup) error); ok { - r1 = rf(_a0, _a1) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} diff --git a/sdk/internal-shared/README.md b/sdk/internal-shared/README.md deleted file mode 100644 index 1b2e1f7191b..00000000000 --- a/sdk/internal-shared/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Shared Internal Packages - -This folder contains Go packages that are meant for internal use only. -They are in this folder rather than "internal" since they are also shared -with the core project. - -If you're writing a plugin or are any other type of external user, please -do not use these packages directly. We will NOT be maintaining normal -semver-style compatibility on these packages and no compatibility is -guaranteed at all. diff --git a/sdk/internal-shared/pluginclient/client.go b/sdk/internal-shared/pluginclient/client.go deleted file mode 100644 index 64ba933e3f5..00000000000 --- a/sdk/internal-shared/pluginclient/client.go +++ /dev/null @@ -1,53 +0,0 @@ -package pluginclient - -import ( - "fmt" - - "github.com/hashicorp/go-argmapper" - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" - - internalplugin "github.com/hashicorp/waypoint/sdk/internal/plugin" -) - -// ClientConfig returns the base client config to use when connecting -// to a plugin. This sets the handshake config, protocols, etc. Manually -// override any values you want to set. -func ClientConfig(log hclog.Logger) *plugin.ClientConfig { - return &plugin.ClientConfig{ - HandshakeConfig: internalplugin.Handshake, - VersionedPlugins: internalplugin.Plugins(internalplugin.WithLogger(log)), - AllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC}, - - // We always set managed to true just in case we don't properly - // call Kill so that CleanupClients gets it. If we do properly call - // Kill, then it is a no-op to call it again so this is safe. - Managed: true, - - // This is super important. There appears to be a bug with AutoMTLS - // when using GRPCBroker and listening from the _client_ side. The - // TLS fails to negotiate. For now we just disable this but we should - // look into fixing that later. - AutoMTLS: false, - } -} - -// Mappers returns the mappers supported by the plugin. -func Mappers(c *plugin.Client) ([]*argmapper.Func, error) { - rpcClient, err := c.Client() - if err != nil { - return nil, err - } - - v, err := rpcClient.Dispense("mapper") - if err != nil { - return nil, err - } - - client, ok := v.(*internalplugin.MapperClient) - if !ok { - return nil, fmt.Errorf("mapper service was unexpected type: %T", v) - } - - return client.Mappers() -} diff --git a/sdk/internal-shared/protomappers/mappers.go b/sdk/internal-shared/protomappers/mappers.go deleted file mode 100644 index bdbfe779b88..00000000000 --- a/sdk/internal-shared/protomappers/mappers.go +++ /dev/null @@ -1,257 +0,0 @@ -package protomappers - -import ( - "context" - "io" - - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" - "github.com/mitchellh/mapstructure" - "google.golang.org/grpc" - - "github.com/hashicorp/waypoint/sdk/component" - "github.com/hashicorp/waypoint/sdk/datadir" - "github.com/hashicorp/waypoint/sdk/history" - pluginhistory "github.com/hashicorp/waypoint/sdk/internal/plugin/history" - pluginterminal "github.com/hashicorp/waypoint/sdk/internal/plugin/terminal" - "github.com/hashicorp/waypoint/sdk/internal/pluginargs" - pb "github.com/hashicorp/waypoint/sdk/proto" - "github.com/hashicorp/waypoint/sdk/terminal" -) - -// All is the list of all mappers as raw function pointers. -var All = []interface{}{ - Source, - SourceProto, - JobInfo, - JobInfoProto, - DeploymentConfig, - DeploymentConfigProto, - DatadirProject, - DatadirApp, - DatadirComponent, - DatadirProjectProto, - DatadirAppProto, - DatadirComponentProto, - Logger, - LoggerProto, - TerminalUI, - TerminalUIProto, - HistoryClient, - HistoryClientProto, - LabelSet, - LabelSetProto, -} - -// Source maps Args.Source to component.Source. -func Source(input *pb.Args_Source) (*component.Source, error) { - var result component.Source - return &result, mapstructure.Decode(input, &result) -} - -// SourceProto -func SourceProto(input *component.Source) (*pb.Args_Source, error) { - var result pb.Args_Source - return &result, mapstructure.Decode(input, &result) -} - -// JobInfo maps Args.JobInfo to component.JobInfo. -func JobInfo(input *pb.Args_JobInfo) (*component.JobInfo, error) { - var result component.JobInfo - return &result, mapstructure.Decode(input, &result) -} - -// JobInfoProto -func JobInfoProto(input *component.JobInfo) (*pb.Args_JobInfo, error) { - var result pb.Args_JobInfo - return &result, mapstructure.Decode(input, &result) -} - -// DeploymentConfig -func DeploymentConfig(input *pb.Args_DeploymentConfig) (*component.DeploymentConfig, error) { - var result component.DeploymentConfig - return &result, mapstructure.Decode(input, &result) -} - -func DeploymentConfigProto(input *component.DeploymentConfig) (*pb.Args_DeploymentConfig, error) { - var result pb.Args_DeploymentConfig - return &result, mapstructure.Decode(input, &result) -} - -// DatadirProject maps *pb.Args_DataDir_Project to *datadir.Project -func DatadirProject(input *pb.Args_DataDir_Project) *datadir.Project { - dir := datadir.NewBasicDir(input.CacheDir, input.DataDir) - return &datadir.Project{Dir: dir} -} - -func DatadirProjectProto(input *datadir.Project) *pb.Args_DataDir_Project { - return &pb.Args_DataDir_Project{ - CacheDir: input.CacheDir(), - DataDir: input.DataDir(), - } -} - -// DatadirApp maps *pb.Args_DataDir_App to *datadir.App -func DatadirApp(input *pb.Args_DataDir_App) *datadir.App { - dir := datadir.NewBasicDir(input.CacheDir, input.DataDir) - return &datadir.App{Dir: dir} -} - -func DatadirAppProto(input *datadir.App) *pb.Args_DataDir_App { - return &pb.Args_DataDir_App{ - CacheDir: input.CacheDir(), - DataDir: input.DataDir(), - } -} - -// DatadirComponent maps *pb.Args_DataDir_Component to *datadir.Component -func DatadirComponent(input *pb.Args_DataDir_Component) *datadir.Component { - dir := datadir.NewBasicDir(input.CacheDir, input.DataDir) - return &datadir.Component{Dir: dir} -} - -func DatadirComponentProto(input *datadir.Component) *pb.Args_DataDir_Component { - return &pb.Args_DataDir_Component{ - CacheDir: input.CacheDir(), - DataDir: input.DataDir(), - } -} - -// Logger maps *pb.Args_Logger to an hclog.Logger -func Logger(input *pb.Args_Logger) hclog.Logger { - // We use the default logger as the base. Within a plugin we always set - // it so we can confidently use this. This lets plugins potentially mess - // with this but that's a risk we have to take. - return hclog.L().ResetNamed(input.Name) -} - -func LoggerProto(log hclog.Logger) *pb.Args_Logger { - return &pb.Args_Logger{ - Name: log.Name(), - } -} - -// TerminalUI maps *pb.Args_TerminalUI to an hclog.TerminalUI -func TerminalUI( - ctx context.Context, - input *pb.Args_TerminalUI, - log hclog.Logger, - internal *pluginargs.Internal, -) (terminal.UI, error) { - // Create our plugin - p := &pluginterminal.UIPlugin{ - Mappers: internal.Mappers, - Logger: log, - } - - conn, err := internal.Broker.Dial(input.StreamId) - if err != nil { - return nil, err - } - internal.Cleanup.Do(func() { conn.Close() }) - - client, err := p.GRPCClient(ctx, internal.Broker, conn) - if err != nil { - return nil, err - } - - // Our UI should implement close since we have to stop streams and - // such but we gate it here in case we ever change the implementation. - if closer, ok := client.(io.Closer); ok { - internal.Cleanup.Do(func() { closer.Close() }) - } - - return client.(terminal.UI), nil -} - -func TerminalUIProto( - ui terminal.UI, - log hclog.Logger, - internal *pluginargs.Internal, -) *pb.Args_TerminalUI { - // Create our plugin - p := &pluginterminal.UIPlugin{ - Impl: ui, - Mappers: internal.Mappers, - Logger: log, - } - - id := internal.Broker.NextId() - - // Serve it - go internal.Broker.AcceptAndServe(id, func(opts []grpc.ServerOption) *grpc.Server { - server := plugin.DefaultGRPCServer(opts) - if err := p.GRPCServer(internal.Broker, server); err != nil { - panic(err) - } - return server - }) - - return &pb.Args_TerminalUI{StreamId: id} -} - -func LabelSet(input *pb.Args_LabelSet) *component.LabelSet { - return &component.LabelSet{ - Labels: input.Labels, - } -} - -func LabelSetProto(labels *component.LabelSet) *pb.Args_LabelSet { - return &pb.Args_LabelSet{Labels: labels.Labels} -} - -// HistoryClient connects to a history.Client served via the plugin interface. -// -// Note these are tested in sdk/internal/plugin via testDynamicFunc. -func HistoryClient( - ctx context.Context, - log hclog.Logger, - input *pb.Args_HistoryClient, - internal *pluginargs.Internal, -) (history.Client, error) { - // Create our plugin - p := &pluginhistory.HistoryPlugin{ - Mappers: internal.Mappers, - Logger: log, - } - - conn, err := internal.Broker.Dial(input.StreamId) - if err != nil { - return nil, err - } - internal.Cleanup.Do(func() { conn.Close() }) - - client, err := p.GRPCClient(ctx, internal.Broker, conn) - if err != nil { - return nil, err - } - - return client.(history.Client), nil -} - -// HistoryClientProto takes a history.Client and serves it over the plugin interface. -func HistoryClientProto( - client history.Client, - log hclog.Logger, - internal *pluginargs.Internal, -) *pb.Args_HistoryClient { - // Create our plugin - p := &pluginhistory.HistoryPlugin{ - Impl: client, - Mappers: internal.Mappers, - Logger: log, - } - - id := internal.Broker.NextId() - - // Serve it - go internal.Broker.AcceptAndServe(id, func(opts []grpc.ServerOption) *grpc.Server { - server := plugin.DefaultGRPCServer(opts) - if err := p.GRPCServer(internal.Broker, server); err != nil { - panic(err) - } - return server - }) - - return &pb.Args_HistoryClient{StreamId: id} -} diff --git a/sdk/internal-shared/protomappers/mappers_test.go b/sdk/internal-shared/protomappers/mappers_test.go deleted file mode 100644 index 4c01ed3e855..00000000000 --- a/sdk/internal-shared/protomappers/mappers_test.go +++ /dev/null @@ -1,60 +0,0 @@ -package protomappers - -import ( - "testing" - - "github.com/hashicorp/go-argmapper" - "github.com/stretchr/testify/require" - - "github.com/hashicorp/waypoint/sdk/component" - pb "github.com/hashicorp/waypoint/sdk/proto" -) - -func TestMappers(t *testing.T) { - var cases = []struct { - Name string - Mapper interface{} - Input []interface{} - Output interface{} - Error string - }{ - { - "Source", - Source, - []interface{}{&pb.Args_Source{App: "foo"}}, - &component.Source{App: "foo"}, - "", - }, - - { - "SourceProto", - SourceProto, - []interface{}{&component.Source{App: "foo"}}, - &pb.Args_Source{App: "foo"}, - "", - }, - } - - for _, tt := range cases { - t.Run(tt.Name, func(t *testing.T) { - require := require.New(t) - - f, err := argmapper.NewFunc(tt.Mapper) - require.NoError(err) - - var args []argmapper.Arg - for _, input := range tt.Input { - args = append(args, argmapper.Typed(input)) - } - - result := f.Call(args...) - if tt.Error != "" { - require.Error(result.Err()) - require.Contains(result.Err().Error(), tt.Error) - return - } - require.NoError(result.Err()) - require.Equal(tt.Output, result.Out(0)) - }) - } -} diff --git a/sdk/internal/funcspec/any_conv.go b/sdk/internal/funcspec/any_conv.go deleted file mode 100644 index 7661cf22d23..00000000000 --- a/sdk/internal/funcspec/any_conv.go +++ /dev/null @@ -1,49 +0,0 @@ -package funcspec - -import ( - "reflect" - - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes" - "github.com/golang/protobuf/ptypes/any" - "github.com/hashicorp/go-argmapper" -) - -// anyConvGen is an argmapper.ConverterGenFunc that dynamically creates -// converters to *any.Any for types that implement proto.Message. This -// allows automatic conversion to *any.Any. -// -// This is automatically injected for all funcspec.Func calls. -func anyConvGen(v argmapper.Value) (*argmapper.Func, error) { - anyType := reflect.TypeOf((*any.Any)(nil)) - protoMessageType := reflect.TypeOf((*proto.Message)(nil)).Elem() - if !v.Type.Implements(protoMessageType) { - return nil, nil - } - - // We take this value as our input. - inputSet, err := argmapper.NewValueSet([]argmapper.Value{v}) - if err != nil { - return nil, err - } - - // Generate an int with the subtype of the string value - outputSet, err := argmapper.NewValueSet([]argmapper.Value{argmapper.Value{ - Name: v.Name, - Type: anyType, - Subtype: proto.MessageName(reflect.Zero(v.Type).Interface().(proto.Message)), - }}) - if err != nil { - return nil, err - } - - return argmapper.BuildFunc(inputSet, outputSet, func(in, out *argmapper.ValueSet) error { - anyVal, err := ptypes.MarshalAny(inputSet.Typed(v.Type).Value.Interface().(proto.Message)) - if err != nil { - return err - } - - outputSet.Typed(anyType).Value = reflect.ValueOf(anyVal) - return nil - }) -} diff --git a/sdk/internal/funcspec/args.go b/sdk/internal/funcspec/args.go deleted file mode 100644 index c6325d168b3..00000000000 --- a/sdk/internal/funcspec/args.go +++ /dev/null @@ -1,22 +0,0 @@ -package funcspec - -import ( - "github.com/golang/protobuf/ptypes/any" - "github.com/hashicorp/go-argmapper" - - pb "github.com/hashicorp/waypoint/sdk/proto" -) - -// Args is a type that will be populated with all the expected args of -// the FuncSpec. This can be used in the callback (cb) to Func. -type Args []*pb.FuncSpec_Value - -// appendValue appends an argmapper.Value to Args. The Value must -// be an *any.Any. -func appendValue(args Args, v argmapper.Value) Args { - return append(args, &pb.FuncSpec_Value{ - Name: v.Name, - Type: v.Subtype, - Value: v.Value.Interface().(*any.Any), - }) -} diff --git a/sdk/internal/funcspec/func.go b/sdk/internal/funcspec/func.go deleted file mode 100644 index c63e136727f..00000000000 --- a/sdk/internal/funcspec/func.go +++ /dev/null @@ -1,146 +0,0 @@ -package funcspec - -import ( - "reflect" - - "github.com/golang/protobuf/ptypes" - "github.com/golang/protobuf/ptypes/any" - "github.com/hashicorp/go-argmapper" - - pb "github.com/hashicorp/waypoint/sdk/proto" -) - -// Func takes a FuncSpec and returns a *mapper.Func that can be called -// to invoke this function. The callback can have an argument type of Args -// in order to get access to the required dynamic proto.Any types of the -// FuncSpec. -func Func(s *pb.FuncSpec, cb interface{}, args ...argmapper.Arg) *argmapper.Func { - // Build a Func around our callback so that we can inspect the - // input/output sets since we want to merge with that. - cbFunc, err := argmapper.NewFunc(cb) - if err != nil { - panic(err) - } - - // Create the argmapper input values. All our args are expected to be - // protobuf Any types that have a subtype matching our string name. - // We append them directly to our expected values for the callback. - // This lets us get our callback types in addition to our funcspec types. - inputValues := cbFunc.Input().Values() - for _, arg := range s.Args { - inputValues = append(inputValues, argmapper.Value{ - Name: arg.Name, - Type: anyType, - Subtype: arg.Type, - }) - } - - // Remove the Args value if there is one, since we're going to populate - // that later and we don't need it for the initial call. - for i, v := range inputValues { - if v.Type == argsType { - inputValues[i] = inputValues[len(inputValues)-1] - inputValues = inputValues[:len(inputValues)-1] - break - } - } - - inputSet, err := argmapper.NewValueSet(inputValues) - if err != nil { - panic(err) - } - - // Build our output set. By default this just matches our output function. - outputSet := cbFunc.Output() - - // If we have results specified on the Spec, then we expect this to represent - // a mapper. Mapper callbacks MUST return *any.Any or []*any.Any. When we - // have a mapper, we change the output type to be all the values we're - // mapping to. - if len(s.Result) > 0 { - var outputValues []argmapper.Value - for _, result := range s.Result { - outputValues = append(outputValues, argmapper.Value{ - Name: result.Name, - Type: anyType, - Subtype: result.Type, - }) - } - - outputSet, err = argmapper.NewValueSet(outputValues) - if err != nil { - panic(err) - } - } - - result, err := argmapper.BuildFunc(inputSet, outputSet, func(in, out *argmapper.ValueSet) error { - callArgs := make([]argmapper.Arg, 0, len(args)+len(in.Values())) - - // Build up our callArgs which we'll pass to our callback. We pass - // through all args except for *any.Any values. For *any values, we - // add them to our Args list. - var args Args - for _, v := range in.Values() { - // If we have any *any.Any then we append it to args - if v.Type == anyType { - args = appendValue(args, v) - continue - } - - // If we have any other type, then we set it directly. - callArgs = append(callArgs, v.Arg()) - } - - // Add our grouped Args type. - callArgs = append(callArgs, argmapper.Typed(args)) - - // Call into our callback. This populates our callback function output. - cbOut := cbFunc.Output() - if err := cbOut.FromResult(cbFunc.Call(callArgs...)); err != nil { - return err - } - - // If we aren't a mapper, we return now since we've populated our callback. - if len(s.Result) == 0 { - return nil - } - - // We're a mapper, so we have to go through our values and look - // for the *any.Any value or []*any.Any and populate our expected - // outputs. - for _, v := range cbOut.Values() { - switch v.Type { - case anyType: - // We're seeing an *any.Any. So we encode this and try - // to match it to any value that we have. - anyVal := v.Value.Interface().(*any.Any) - st, err := ptypes.AnyMessageName(anyVal) - if err != nil { - return err - } - - expected := out.TypedSubtype(v.Type, st) - if expected == nil { - continue - } - - expected.Value = v.Value - } - } - - // Go through our callback output looking - return nil - }, append([]argmapper.Arg{ - argmapper.ConverterGen(anyConvGen), - }, args...)...) - if err != nil { - panic(err) - } - - return result -} - -var ( - anyType = reflect.TypeOf((*any.Any)(nil)) - argsType = reflect.TypeOf(Args(nil)) -) diff --git a/sdk/internal/funcspec/func_test.go b/sdk/internal/funcspec/func_test.go deleted file mode 100644 index b1472540f54..00000000000 --- a/sdk/internal/funcspec/func_test.go +++ /dev/null @@ -1,120 +0,0 @@ -package funcspec - -import ( - "reflect" - "testing" - - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes" - "github.com/golang/protobuf/ptypes/any" - "github.com/hashicorp/go-argmapper" - "github.com/stretchr/testify/require" - - "github.com/hashicorp/go-hclog" - pb "github.com/hashicorp/waypoint/sdk/proto" -) - -func init() { - hclog.L().SetLevel(hclog.Trace) -} - -func TestFunc(t *testing.T) { - t.Run("single any result", func(t *testing.T) { - require := require.New(t) - - spec, err := Spec(func(*pb.Empty) *pb.Empty { return &pb.Empty{} }) - require.NoError(err) - require.NotNil(spec) - - f := Func(spec, func(args Args) (*any.Any, error) { - require.Len(args, 1) - require.NotNil(args[0]) - - // At this point we'd normally RPC out. - return ptypes.MarshalAny(&pb.Empty{}) - }) - - msg, err := ptypes.MarshalAny(&pb.Empty{}) - require.NoError(err) - - result := f.Call(argmapper.TypedSubtype(msg, proto.MessageName(&pb.Empty{}))) - require.NoError(result.Err()) - require.Equal(reflect.Struct, reflect.ValueOf(result.Out(0)).Kind()) - }) - - t.Run("single missing requirement", func(t *testing.T) { - require := require.New(t) - - spec, err := Spec(func(*pb.Empty) *pb.Empty { return &pb.Empty{} }) - require.NoError(err) - require.NotNil(spec) - - f := Func(spec, func(args Args) (*any.Any, error) { - require.Len(args, 1) - require.NotNil(args[0]) - - // At this point we'd normally RPC out. - return ptypes.MarshalAny(&pb.Empty{}) - }) - - // Create an argument with the wrong type - msg, err := ptypes.MarshalAny(&pb.FuncSpec{}) - require.NoError(err) - result := f.Call(argmapper.TypedSubtype(msg, proto.MessageName(&pb.FuncSpec{}))) - - // We should have an error - require.Error(result.Err()) - require.Contains(result.Err().Error(), "argument cannot") - }) - - t.Run("match callback output if no results", func(t *testing.T) { - require := require.New(t) - - spec, err := Spec(func(*pb.Empty) *pb.Empty { return &pb.Empty{} }) - require.NoError(err) - require.NotNil(spec) - - // No results - spec.Result = nil - - // Build our func to return a primitive - f := Func(spec, func(args Args) int { - require.Len(args, 1) - require.NotNil(args[0]) - return 42 - }) - - // Call the function with the proto type we expect - msg, err := ptypes.MarshalAny(&pb.Empty{}) - require.NoError(err) - result := f.Call(argmapper.TypedSubtype(msg, proto.MessageName(&pb.Empty{}))) - - // Should succeed and give us our primitive - require.NoError(result.Err()) - require.Equal(42, result.Out(0)) - }) - - t.Run("provide input arguments", func(t *testing.T) { - require := require.New(t) - - spec, err := Spec(func(*pb.Empty) *pb.Empty { return &pb.Empty{} }) - require.NoError(err) - require.NotNil(spec) - - f := Func(spec, func(args Args, v int) (*any.Any, error) { - require.Len(args, 1) - require.NotNil(args[0]) - require.Equal(42, v) - - // At this point we'd normally RPC out. - return ptypes.MarshalAny(&pb.Empty{}) - }, argmapper.Typed(int(42))) - - msg, err := ptypes.MarshalAny(&pb.Empty{}) - require.NoError(err) - - result := f.Call(argmapper.TypedSubtype(msg, proto.MessageName(&pb.Empty{}))) - require.NoError(result.Err()) - require.Equal(reflect.Struct, reflect.ValueOf(result.Out(0)).Kind()) - }) -} diff --git a/sdk/internal/funcspec/spec.go b/sdk/internal/funcspec/spec.go deleted file mode 100644 index 8dd8f857ec7..00000000000 --- a/sdk/internal/funcspec/spec.go +++ /dev/null @@ -1,89 +0,0 @@ -package funcspec - -import ( - "context" - "reflect" - - "github.com/golang/protobuf/proto" - "github.com/hashicorp/go-argmapper" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - pb "github.com/hashicorp/waypoint/sdk/proto" -) - -// Spec takes a function pointer and generates a FuncSpec from it. The -// function must only take arguments that are proto.Message implementations -// or have a chain of converters that directly convert to a proto.Message. -func Spec(fn interface{}, args ...argmapper.Arg) (*pb.FuncSpec, error) { - if fn == nil { - return nil, status.Errorf(codes.Unimplemented, "required plugin type not implemented") - } - - filterProto := argmapper.FilterType(protoMessageType) - - // Copy our args cause we're going to use append() and we don't - // want to modify our caller. - args = append([]argmapper.Arg{ - argmapper.FilterOutput(filterProto), - }, args...) - - // Build our function - f, err := argmapper.NewFunc(fn) - if err != nil { - return nil, err - } - - filter := argmapper.FilterOr( - argmapper.FilterType(contextType), - filterProto, - ) - - // Redefine the function in terms of protobuf messages. "Redefine" changes - // the inputs of a function to only require values that match our filter - // function. In our case, that is protobuf messages. - f, err = f.Redefine(append(args, - argmapper.FilterInput(filter), - )...) - if err != nil { - return nil, err - } - - // Grab the input set of the function and build up our funcspec - result := pb.FuncSpec{Name: f.Name()} - for _, v := range f.Input().Values() { - if !filterProto(v) { - continue - } - - result.Args = append(result.Args, &pb.FuncSpec_Value{ - Name: v.Name, - Type: typeToMessage(v.Type), - }) - } - - // Grab the output set and store that - for _, v := range f.Output().Values() { - // We only advertise proto types in output since those are the only - // types we can send across the plugin boundary. - if !filterProto(v) { - continue - } - - result.Result = append(result.Result, &pb.FuncSpec_Value{ - Name: v.Name, - Type: typeToMessage(v.Type), - }) - } - - return &result, nil -} - -func typeToMessage(typ reflect.Type) string { - return proto.MessageName(reflect.Zero(typ).Interface().(proto.Message)) -} - -var ( - contextType = reflect.TypeOf((*context.Context)(nil)).Elem() - protoMessageType = reflect.TypeOf((*proto.Message)(nil)).Elem() -) diff --git a/sdk/internal/funcspec/spec_test.go b/sdk/internal/funcspec/spec_test.go deleted file mode 100644 index 84bdeef301a..00000000000 --- a/sdk/internal/funcspec/spec_test.go +++ /dev/null @@ -1,137 +0,0 @@ -package funcspec - -import ( - "reflect" - "testing" - - "github.com/hashicorp/go-argmapper" - "github.com/stretchr/testify/require" - - "github.com/hashicorp/go-hclog" - pb "github.com/hashicorp/waypoint/sdk/proto" -) - -func init() { - hclog.L().SetLevel(hclog.Trace) -} - -func TestSpec(t *testing.T) { - t.Run("proto to proto", func(t *testing.T) { - require := require.New(t) - - spec, err := Spec(func(*pb.Empty) *pb.Empty { return nil }) - require.NoError(err) - require.NotNil(spec) - require.Len(spec.Args, 1) - require.Empty(spec.Args[0].Name) - require.Equal("proto.Empty", spec.Args[0].Type) - require.Len(spec.Result, 1) - require.Empty(spec.Result[0].Name) - require.Equal("proto.Empty", spec.Result[0].Type) - }) - - t.Run("converted args to proto", func(t *testing.T) { - require := require.New(t) - - type Foo struct{} - - spec, err := Spec(func(*Foo) *pb.Empty { return nil }, - argmapper.Converter(func(*pb.Empty) *Foo { return nil }), - ) - require.NoError(err) - require.NotNil(spec) - require.Len(spec.Args, 1) - require.Empty(spec.Args[0].Name) - require.Equal("proto.Empty", spec.Args[0].Type) - require.Len(spec.Result, 1) - require.Empty(spec.Result[0].Name) - require.Equal("proto.Empty", spec.Result[0].Type) - }) - - t.Run("unsatisfied conversion", func(t *testing.T) { - require := require.New(t) - - type Foo struct{} - type Bar struct{} - - spec, err := Spec(func(*Foo) *pb.Empty { return nil }, - argmapper.Converter(func(*pb.Empty) *Bar { return nil }), - ) - require.Error(err) - require.Nil(spec) - }) - - t.Run("proto to int", func(t *testing.T) { - require := require.New(t) - - spec, err := Spec(func(*pb.Empty) int { return 0 }) - require.Error(err) - require.Nil(spec) - }) - - t.Run("WithOutput proto to int", func(t *testing.T) { - require := require.New(t) - - spec, err := Spec(func(*pb.Empty) int { return 0 }, - argmapper.FilterOutput(argmapper.FilterType(reflect.TypeOf(int(0)))), - ) - require.NoError(err) - require.NotNil(spec) - require.Len(spec.Args, 1) - require.Empty(spec.Args[0].Name) - require.Equal("proto.Empty", spec.Args[0].Type) - require.Empty(spec.Result) - }) - - t.Run("WithOutput proto to interface, doesn't implement", func(t *testing.T) { - require := require.New(t) - - spec, err := Spec(func(*pb.Empty) struct{} { return struct{}{} }, - argmapper.FilterOutput(argmapper.FilterType(reflect.TypeOf((*testSpecInterface)(nil)).Elem())), - ) - require.Error(err) - require.Nil(spec) - }) - - t.Run("WithOutput proto to interface", func(t *testing.T) { - require := require.New(t) - - spec, err := Spec(func(*pb.Empty) *testSpecInterfaceImpl { return nil }, - argmapper.FilterOutput(argmapper.FilterType(reflect.TypeOf((*testSpecInterface)(nil)).Elem())), - ) - require.NoError(err) - require.NotNil(spec) - require.Len(spec.Args, 1) - require.Empty(spec.Args[0].Name) - require.Equal("proto.Empty", spec.Args[0].Type) - require.Empty(spec.Result) - }) - - t.Run("args as extra values", func(t *testing.T) { - require := require.New(t) - - type Foo struct{} - type Bar struct{} - - spec, err := Spec(func(*Foo, *Bar) *pb.Empty { return nil }, - argmapper.Converter(func(*pb.Empty) *Foo { return nil }), - argmapper.Typed(&Bar{}), - ) - require.NoError(err) - require.NotNil(spec) - require.Len(spec.Args, 1) - require.Empty(spec.Args[0].Name) - require.Equal("proto.Empty", spec.Args[0].Type) - require.Len(spec.Result, 1) - require.Empty(spec.Result[0].Name) - require.Equal("proto.Empty", spec.Result[0].Type) - }) -} - -type testSpecInterface interface { - hello() -} - -type testSpecInterfaceImpl struct{} - -func (testSpecInterfaceImpl) hello() {} diff --git a/sdk/internal/plugin/authenticator.go b/sdk/internal/plugin/authenticator.go deleted file mode 100644 index d9667cbbf96..00000000000 --- a/sdk/internal/plugin/authenticator.go +++ /dev/null @@ -1,225 +0,0 @@ -package plugin - -import ( - "context" - "reflect" - - "github.com/golang/protobuf/ptypes/empty" - "google.golang.org/grpc" - - "github.com/hashicorp/go-argmapper" - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" - "github.com/hashicorp/waypoint/sdk/component" - "github.com/hashicorp/waypoint/sdk/internal/funcspec" - "github.com/hashicorp/waypoint/sdk/internal/pluginargs" - "github.com/hashicorp/waypoint/sdk/internal/testproto" - pb "github.com/hashicorp/waypoint/sdk/proto" -) - -// authenticatorProtoClient is the interface implemented by all gRPC services that -// have the authenticator RPC methods. -type authenticatorProtoClient interface { - IsAuthenticator(context.Context, *empty.Empty, ...grpc.CallOption) (*pb.ImplementsResp, error) - Auth(context.Context, *pb.FuncSpec_Args, ...grpc.CallOption) (*pb.Auth_AuthResponse, error) - ValidateAuth(context.Context, *pb.FuncSpec_Args, ...grpc.CallOption) (*empty.Empty, error) - AuthSpec(context.Context, *empty.Empty, ...grpc.CallOption) (*pb.FuncSpec, error) - ValidateAuthSpec(context.Context, *empty.Empty, ...grpc.CallOption) (*pb.FuncSpec, error) -} - -// authenticatorClient implements component.Authenticator for a service that -// has the authenticator methods implemented -type authenticatorClient struct { - Client authenticatorProtoClient - Logger hclog.Logger - Broker *plugin.GRPCBroker - Mappers []*argmapper.Func -} - -func (c *authenticatorClient) Implements(ctx context.Context) (bool, error) { - resp, err := c.Client.IsAuthenticator(ctx, &empty.Empty{}) - if err != nil { - return false, err - } - - return resp.Implements, nil -} - -func (c *authenticatorClient) AuthFunc() interface{} { - if c == nil { - return func() (*component.AuthResult, error) { - return nil, nil - } - } - - // Get the spec - spec, err := c.Client.AuthSpec(context.Background(), &empty.Empty{}) - if err != nil { - return funcErr(err) - } - - // We don't want to be a mapper - spec.Result = nil - - return funcspec.Func(spec, c.auth, - argmapper.Logger(c.Logger), - argmapper.Typed(&pluginargs.Internal{ - Broker: c.Broker, - Mappers: c.Mappers, - Cleanup: &pluginargs.Cleanup{}, - }), - ) -} - -func (c *authenticatorClient) ValidateAuthFunc() interface{} { - if c == nil { - return func() error { - return nil - } - } - - // Get the spec - spec, err := c.Client.ValidateAuthSpec(context.Background(), &empty.Empty{}) - if err != nil { - return funcErr(err) - } - - // We don't want to be a mapper - spec.Result = nil - - return funcspec.Func(spec, c.validateAuth, - argmapper.Logger(c.Logger), - argmapper.Typed(&pluginargs.Internal{ - Broker: c.Broker, - Mappers: c.Mappers, - Cleanup: &pluginargs.Cleanup{}, - }), - ) -} - -func (c *authenticatorClient) auth( - ctx context.Context, - args funcspec.Args, - internal *pluginargs.Internal, -) (*component.AuthResult, error) { - // Run the cleanup - defer internal.Cleanup.Close() - - // Call our function - resp, err := c.Client.Auth(ctx, &pb.FuncSpec_Args{Args: args}) - if err != nil { - return nil, err - } - - return &component.AuthResult{ - Authenticated: resp.Authenticated, - }, nil -} - -func (c *authenticatorClient) validateAuth( - ctx context.Context, - args funcspec.Args, - internal *pluginargs.Internal, -) error { - // Run the cleanup - defer internal.Cleanup.Close() - - // Call our function - _, err := c.Client.ValidateAuth(ctx, &pb.FuncSpec_Args{Args: args}) - return err -} - -// authenticatorServer implements the common Authenticator-related RPC calls. -type authenticatorServer struct { - *base - Impl interface{} -} - -func (s *authenticatorServer) IsAuthenticator( - ctx context.Context, - empty *empty.Empty, -) (*pb.ImplementsResp, error) { - _, ok := s.Impl.(component.Authenticator) - return &pb.ImplementsResp{Implements: ok}, nil -} - -func (s *authenticatorServer) AuthSpec( - ctx context.Context, - args *empty.Empty, -) (*pb.FuncSpec, error) { - return funcspec.Spec(s.Impl.(component.Authenticator).AuthFunc(), - argmapper.ConverterFunc(s.Mappers...), - argmapper.Logger(s.Logger), - argmapper.Typed(s.internal()), - - // We expect a auth result. - argmapper.FilterOutput(argmapper.FilterOr( - argmapper.FilterType(reflect.TypeOf((*component.AuthResult)(nil))), - - // We expect this for tests. - argmapper.FilterType(reflect.TypeOf((*testproto.Data)(nil))), - )), - ) -} - -func (s *authenticatorServer) Auth( - ctx context.Context, - args *pb.FuncSpec_Args, -) (*pb.Auth_AuthResponse, error) { - internal := s.internal() - defer internal.Cleanup.Close() - - raw, err := callDynamicFunc2(s.Impl.(component.Authenticator).AuthFunc(), args.Args, - argmapper.ConverterFunc(s.Mappers...), - argmapper.Typed(internal), - argmapper.Typed(ctx), - ) - if err != nil { - return nil, err - } - - result, ok := raw.(*component.AuthResult) - if !ok { - return &pb.Auth_AuthResponse{ - Authenticated: false, - }, nil - } - - return &pb.Auth_AuthResponse{ - Authenticated: result.Authenticated, - }, nil -} - -func (s *authenticatorServer) ValidateAuthSpec( - ctx context.Context, - args *empty.Empty, -) (*pb.FuncSpec, error) { - return funcspec.Spec(s.Impl.(component.Authenticator).ValidateAuthFunc(), - argmapper.ConverterFunc(s.Mappers...), - argmapper.Logger(s.Logger), - argmapper.Typed(s.internal()), - ) -} - -func (s *authenticatorServer) ValidateAuth( - ctx context.Context, - args *pb.FuncSpec_Args, -) (*empty.Empty, error) { - internal := s.internal() - defer internal.Cleanup.Close() - - _, err := callDynamicFunc2(s.Impl.(component.Authenticator).ValidateAuthFunc(), args.Args, - argmapper.ConverterFunc(s.Mappers...), - argmapper.Typed(internal), - argmapper.Typed(ctx), - ) - if err != nil { - return nil, err - } - - return &empty.Empty{}, nil -} - -var ( - _ component.Authenticator = (*authenticatorClient)(nil) -) diff --git a/sdk/internal/plugin/base.go b/sdk/internal/plugin/base.go deleted file mode 100644 index 32cb87cb634..00000000000 --- a/sdk/internal/plugin/base.go +++ /dev/null @@ -1,28 +0,0 @@ -package plugin - -import ( - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" - "github.com/hashicorp/go-argmapper" - - "github.com/hashicorp/waypoint/sdk/internal/pluginargs" -) - -// base contains shared logic for all plugins. This should be embedded -// in every plugin implementation. -type base struct { - Broker *plugin.GRPCBroker - Logger hclog.Logger - Mappers []*argmapper.Func -} - -// internal returns a new pluginargs.Internal that can be used with -// dynamic calls. The Internal structure is an internal-only argument -// that is used to perform cleanup. -func (b *base) internal() *pluginargs.Internal { - return &pluginargs.Internal{ - Broker: b.Broker, - Mappers: b.Mappers, - Cleanup: &pluginargs.Cleanup{}, - } -} diff --git a/sdk/internal/plugin/builder.go b/sdk/internal/plugin/builder.go deleted file mode 100644 index e446c08045c..00000000000 --- a/sdk/internal/plugin/builder.go +++ /dev/null @@ -1,220 +0,0 @@ -package plugin - -import ( - "context" - - "github.com/golang/protobuf/ptypes/empty" - "github.com/hashicorp/go-argmapper" - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/hashicorp/waypoint/sdk/component" - "github.com/hashicorp/waypoint/sdk/docs" - "github.com/hashicorp/waypoint/sdk/internal/funcspec" - "github.com/hashicorp/waypoint/sdk/internal/pluginargs" - "github.com/hashicorp/waypoint/sdk/internal/plugincomponent" - "github.com/hashicorp/waypoint/sdk/proto" -) - -// BuilderPlugin implements plugin.Plugin (specifically GRPCPlugin) for -// the Builder component type. -type BuilderPlugin struct { - plugin.NetRPCUnsupportedPlugin - - Impl component.Builder // Impl is the concrete implementation - Mappers []*argmapper.Func // Mappers - Logger hclog.Logger // Logger -} - -func (p *BuilderPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error { - base := &base{ - Mappers: p.Mappers, - Logger: p.Logger, - Broker: broker, - } - - proto.RegisterBuilderServer(s, &builderServer{ - base: base, - Impl: p.Impl, - - authenticatorServer: &authenticatorServer{ - base: base, - Impl: p.Impl, - }, - }) - return nil -} - -func (p *BuilderPlugin) GRPCClient( - ctx context.Context, - broker *plugin.GRPCBroker, - c *grpc.ClientConn, -) (interface{}, error) { - client := &builderClient{ - client: proto.NewBuilderClient(c), - logger: p.Logger, - broker: broker, - mappers: p.Mappers, - } - - authenticator := &authenticatorClient{ - Client: client.client, - Logger: client.logger, - Broker: client.broker, - Mappers: client.mappers, - } - if ok, err := authenticator.Implements(ctx); err != nil { - return nil, err - } else if ok { - p.Logger.Info("builder plugin capable of auth") - } else { - authenticator = nil - } - - result := &mix_Builder_Authenticator{ - ConfigurableNotify: client, - Builder: client, - Authenticator: authenticator, - Documented: client, - } - - return result, nil -} - -// builderClient is an implementation of component.Builder that -// communicates over gRPC. -type builderClient struct { - client proto.BuilderClient - logger hclog.Logger - broker *plugin.GRPCBroker - mappers []*argmapper.Func -} - -func (c *builderClient) Config() (interface{}, error) { - return configStructCall(context.Background(), c.client) -} - -func (c *builderClient) ConfigSet(v interface{}) error { - return configureCall(context.Background(), c.client, v) -} - -func (c *builderClient) Documentation() (*docs.Documentation, error) { - return documentationCall(context.Background(), c.client) -} - -func (c *builderClient) BuildFunc() interface{} { - // Get the build spec - spec, err := c.client.BuildSpec(context.Background(), &proto.Empty{}) - if err != nil { - return funcErr(err) - } - - // We don't want to be a mapper - spec.Result = nil - - return funcspec.Func(spec, c.build, - argmapper.Logger(c.logger), - argmapper.Typed(&pluginargs.Internal{ - Broker: c.broker, - Mappers: c.mappers, - Cleanup: &pluginargs.Cleanup{}, - }), - ) -} - -func (c *builderClient) build( - ctx context.Context, - args funcspec.Args, -) (component.Artifact, error) { - // Call our function - resp, err := c.client.Build(ctx, &proto.FuncSpec_Args{Args: args}) - if err != nil { - return nil, err - } - - // We return the - return &plugincomponent.Artifact{Any: resp.Result, LabelsVal: resp.Labels}, nil -} - -// builderServer is a gRPC server that the client talks to and calls a -// real implementation of the component. -type builderServer struct { - *base - *authenticatorServer - - Impl component.Builder -} - -func (s *builderServer) ConfigStruct( - ctx context.Context, - empty *empty.Empty, -) (*proto.Config_StructResp, error) { - return configStruct(s.Impl) -} - -func (s *builderServer) Configure( - ctx context.Context, - req *proto.Config_ConfigureRequest, -) (*empty.Empty, error) { - return configure(s.Impl, req) -} - -func (s *builderServer) Documentation( - ctx context.Context, - empty *empty.Empty, -) (*proto.Config_Documentation, error) { - return documentation(s.Impl) -} - -func (s *builderServer) BuildSpec( - ctx context.Context, - args *proto.Empty, -) (*proto.FuncSpec, error) { - if s.Impl == nil { - return nil, status.Errorf(codes.Unimplemented, "plugin does not implement: builder") - } - - return funcspec.Spec(s.Impl.BuildFunc(), - argmapper.Logger(s.Logger), - argmapper.ConverterFunc(s.Mappers...), - argmapper.Typed(s.internal()), - ) -} - -func (s *builderServer) Build( - ctx context.Context, - args *proto.FuncSpec_Args, -) (*proto.Build_Resp, error) { - internal := s.internal() - defer internal.Cleanup.Close() - - encoded, raw, err := callDynamicFuncAny2(s.Impl.BuildFunc(), args.Args, - argmapper.ConverterFunc(s.Mappers...), - argmapper.Logger(s.Logger), - argmapper.Typed(ctx), - argmapper.Typed(internal), - ) - if err != nil { - return nil, err - } - - result := &proto.Build_Resp{Result: encoded} - if artifact, ok := raw.(component.Artifact); ok { - result.Labels = artifact.Labels() - } - - return result, nil -} - -var ( - _ plugin.Plugin = (*BuilderPlugin)(nil) - _ plugin.GRPCPlugin = (*BuilderPlugin)(nil) - _ proto.BuilderServer = (*builderServer)(nil) - _ component.Builder = (*builderClient)(nil) - _ component.Configurable = (*builderClient)(nil) - _ component.Documented = (*builderClient)(nil) - _ component.ConfigurableNotify = (*builderClient)(nil) -) diff --git a/sdk/internal/plugin/builder_mix.go b/sdk/internal/plugin/builder_mix.go deleted file mode 100644 index 9c6f1fb87d0..00000000000 --- a/sdk/internal/plugin/builder_mix.go +++ /dev/null @@ -1,12 +0,0 @@ -package plugin - -import ( - "github.com/hashicorp/waypoint/sdk/component" -) - -type mix_Builder_Authenticator struct { - component.Authenticator - component.ConfigurableNotify - component.Builder - component.Documented -} diff --git a/sdk/internal/plugin/builder_test.go b/sdk/internal/plugin/builder_test.go deleted file mode 100644 index 3d4a9af7192..00000000000 --- a/sdk/internal/plugin/builder_test.go +++ /dev/null @@ -1,93 +0,0 @@ -package plugin - -import ( - "context" - "testing" - - "github.com/golang/protobuf/ptypes" - "github.com/golang/protobuf/ptypes/any" - "github.com/hashicorp/go-argmapper" - "github.com/hashicorp/go-plugin" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/hashicorp/waypoint/sdk/component" - "github.com/hashicorp/waypoint/sdk/component/mocks" - "github.com/hashicorp/waypoint/sdk/internal/testproto" - pb "github.com/hashicorp/waypoint/sdk/proto" -) - -func TestBuilderBuild(t *testing.T) { - require := require.New(t) - assert := assert.New(t) - - called := false - buildFunc := func(ctx context.Context, args *component.Source) *testproto.Data { - called = true - assert.NotNil(ctx) - assert.Equal("foo", args.App) - return &testproto.Data{Value: "hello"} - } - - mockB := &mocks.Builder{} - mockB.On("BuildFunc").Return(buildFunc) - - plugins := Plugins(WithComponents(mockB), WithMappers(testDefaultMappers(t)...)) - client, server := plugin.TestPluginGRPCConn(t, plugins[1]) - defer client.Close() - defer server.Stop() - - raw, err := client.Dispense("builder") - require.NoError(err) - builder := raw.(component.Builder) - f := builder.BuildFunc().(*argmapper.Func) - require.NotNil(f) - - result := f.Call( - argmapper.Typed(context.Background()), - argmapper.Typed(&pb.Args_Source{App: "foo"}), - ) - require.NoError(result.Err()) - - raw = result.Out(0) - require.NotNil(raw) - require.Implements((*component.Artifact)(nil), raw) - - anyVal := raw.(component.ProtoMarshaler).Proto().(*any.Any) - name, err := ptypes.AnyMessageName(anyVal) - require.NoError(err) - require.Equal("testproto.Data", name) - - require.True(called) -} - -func TestBuilderDynamicFunc_auth(t *testing.T) { - testDynamicFunc(t, "builder", &mockBuilderAuthenticator{}, func(v, f interface{}) { - v.(*mockBuilderAuthenticator).Authenticator.On("AuthFunc").Return(f) - }, func(raw interface{}) interface{} { - return raw.(component.Authenticator).AuthFunc() - }) -} - -func TestBuilderDynamicFunc_validateAuth(t *testing.T) { - testDynamicFunc(t, "builder", &mockBuilderAuthenticator{}, func(v, f interface{}) { - v.(*mockBuilderAuthenticator).Authenticator.On("ValidateAuthFunc").Return(f) - }, func(raw interface{}) interface{} { - return raw.(component.Authenticator).ValidateAuthFunc() - }) -} - -func TestBuilderConfig(t *testing.T) { - mockV := &mockBuilderConfigurable{} - testConfigurable(t, "builder", mockV, &mockV.Configurable) -} - -type mockBuilderAuthenticator struct { - mocks.Builder - mocks.Authenticator -} - -type mockBuilderConfigurable struct { - mocks.Builder - mocks.Configurable -} diff --git a/sdk/internal/plugin/configure.go b/sdk/internal/plugin/configure.go deleted file mode 100644 index 85968088b78..00000000000 --- a/sdk/internal/plugin/configure.go +++ /dev/null @@ -1,198 +0,0 @@ -package plugin - -import ( - "context" - "encoding/json" - - "github.com/golang/protobuf/ptypes/empty" - "github.com/mitchellh/protostructure" - "google.golang.org/grpc" - - "github.com/hashicorp/waypoint/sdk/component" - "github.com/hashicorp/waypoint/sdk/docs" - pb "github.com/hashicorp/waypoint/sdk/proto" -) - -// configStruct is the shared helper to implement the ConfigStruct RPC call -// for components. The logic is the same regardless of component so this can -// be called instead. -func configStruct(impl interface{}) (*pb.Config_StructResp, error) { - c, ok := impl.(component.Configurable) - - // If Configurable isn't implemented, we just return an empty response. - // The nil struct signals to the receiving side that this component - // is not configurable. - if !ok { - return &pb.Config_StructResp{}, nil - } - - v, err := c.Config() - if err != nil { - return nil, err - } - - s, err := protostructure.Encode(v) - if err != nil { - return nil, err - } - - return &pb.Config_StructResp{Struct: s}, nil -} - -// configStructCall is the shared helper to call the ConfigStruct RPC call -// and return the proper struct value for decoding configuration. -func configStructCall(ctx context.Context, c configurableClient) (interface{}, error) { - resp, err := c.ConfigStruct(ctx, &empty.Empty{}) - - // If we had a failure receiving the configuration struct, then - // panic because this should never happen. In the future maybe we can - // support an error return value. - if err != nil { - return nil, err - } - - // If we have no struct, then we have no value so return nil - if resp.Struct == nil { - return nil, nil - } - - result, err := protostructure.New(resp.Struct) - if err != nil { - return nil, err - } - - return result, nil -} - -// configure is the shared helper to implement the Configure RPC call. -func configure(impl interface{}, req *pb.Config_ConfigureRequest) (*empty.Empty, error) { - c, ok := impl.(component.Configurable) - - // This should never happen but if it does just do nothing. This - // should never happen because prior to this ever being called, our core - // calls ConfigStruct and if we return nil then we don't configure anything. - if !ok { - return &empty.Empty{}, nil - } - - // Get our value that we can decode into - v, err := c.Config() - if err != nil { - return nil, err - } - - // Decode our JSON value directly into our structure. - if err := json.Unmarshal(req.Json, v); err != nil { - return nil, err - } - - // If our client also implements the notify interface, call that. - if cn, ok := c.(component.ConfigurableNotify); ok { - if err := cn.ConfigSet(v); err != nil { - return nil, err - } - } - - return &empty.Empty{}, nil -} - -// configureCall calls the Configure RPC endpoint. -func configureCall(ctx context.Context, c configurableClient, v interface{}) error { - jsonv, err := json.Marshal(v) - if err != nil { - return err - } - - _, err = c.Configure(ctx, &pb.Config_ConfigureRequest{ - Json: jsonv, - }) - return err -} - -// documentation is the shared helper to implement the Documentation RPC call -// for components. The logic is the same regardless of component so this can -// be called instead. -func documentation(impl interface{}) (*pb.Config_Documentation, error) { - d, err := component.Documentation(impl) - if err != nil { - return nil, err - } - - dets := d.Details() - - v := &pb.Config_Documentation{ - Description: dets.Description, - Example: dets.Example, - Input: dets.Input, - Output: dets.Output, - Fields: make(map[string]*pb.Config_FieldDocumentation), - } - - for _, f := range d.Fields() { - v.Fields[f.Field] = &pb.Config_FieldDocumentation{ - Name: f.Field, - Type: f.Type, - Default: f.Default, - Synopsis: f.Synopsis, - Summary: f.Summary, - EnvVar: f.EnvVar, - Optional: f.Optional, - } - } - - for _, m := range dets.Mappers { - v.Mappers = append(v.Mappers, &pb.Config_MapperDocumentation{ - Input: m.Input, - Output: m.Output, - Description: m.Description, - }) - } - - return v, nil -} - -// configStructCall is the shared helper to call the ConfigStruct RPC call -// and return the proper struct value for decoding configuration. -func documentationCall(ctx context.Context, c configurableClient) (*docs.Documentation, error) { - resp, err := c.Documentation(ctx, &empty.Empty{}) - if err != nil { - return nil, err - } - - d, err := docs.New() - if err != nil { - return nil, err - } - - d.Example(resp.Example) - d.Description(resp.Description) - d.Input(resp.Input) - d.Output(resp.Output) - - for _, f := range resp.Fields { - d.OverrideField(&docs.FieldDocs{ - Field: f.Name, - Type: f.Type, - Default: f.Default, - Synopsis: f.Synopsis, - Summary: f.Summary, - Optional: f.Optional, - EnvVar: f.EnvVar, - }) - } - - for _, m := range resp.Mappers { - d.AddMapper(m.Input, m.Output, m.Description) - } - - return d, nil -} - -// configurableClient is the interface implemented by all gRPC services that -// have the configuration RPC methods. We use this with the helpers above -// to extract shared logic for component configuration. -type configurableClient interface { - ConfigStruct(context.Context, *empty.Empty, ...grpc.CallOption) (*pb.Config_StructResp, error) - Configure(context.Context, *pb.Config_ConfigureRequest, ...grpc.CallOption) (*empty.Empty, error) - Documentation(context.Context, *empty.Empty, ...grpc.CallOption) (*pb.Config_Documentation, error) -} diff --git a/sdk/internal/plugin/configure_test.go b/sdk/internal/plugin/configure_test.go deleted file mode 100644 index d439dc985ba..00000000000 --- a/sdk/internal/plugin/configure_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package plugin - -import ( - "testing" - - "github.com/hashicorp/go-plugin" - "github.com/hashicorp/hcl/v2/hclparse" - "github.com/stretchr/testify/require" - - "github.com/hashicorp/waypoint/sdk/component" - "github.com/hashicorp/waypoint/sdk/component/mocks" -) - -// testConfigurable is a reusable helper that tests that a component implements -// the Configurable interfaces correctly. -func testConfigurable( - t *testing.T, - typ string, // plugin type - impl interface{}, // full implementation - mockC *mocks.Configurable, -) { - require := require.New(t) - - var config struct { - Name string `hcl:"name"` - } - mockC.On("Config").Return(&config, nil) - - plugins := Plugins(WithComponents(impl), WithMappers(testDefaultMappers(t)...)) - client, server := plugin.TestPluginGRPCConn(t, plugins[1]) - defer client.Close() - defer server.Stop() - - raw, err := client.Dispense(typ) - require.NoError(err) - - src := `name = "foo"` - f, diag := hclparse.NewParser().ParseHCL([]byte(src), "test.hcl") - require.False(diag.HasErrors()) - - diag = component.Configure(raw, f.Body, nil) - require.False(diag.HasErrors()) - require.Equal("foo", config.Name) -} diff --git a/sdk/internal/plugin/destroyer.go b/sdk/internal/plugin/destroyer.go deleted file mode 100644 index d06cfff8f7a..00000000000 --- a/sdk/internal/plugin/destroyer.go +++ /dev/null @@ -1,132 +0,0 @@ -package plugin - -import ( - "context" - - "github.com/golang/protobuf/ptypes/empty" - "github.com/hashicorp/go-argmapper" - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" - "google.golang.org/grpc" - - "github.com/hashicorp/waypoint/sdk/component" - "github.com/hashicorp/waypoint/sdk/internal/funcspec" - "github.com/hashicorp/waypoint/sdk/internal/pluginargs" - pb "github.com/hashicorp/waypoint/sdk/proto" -) - -// destroyerClient implements component.Destroyer for a service that -// has the destroy methods implemented. -type destroyerClient struct { - Client destroyerProtoClient - Logger hclog.Logger - Broker *plugin.GRPCBroker - Mappers []*argmapper.Func -} - -func (c *destroyerClient) Implements(ctx context.Context) (bool, error) { - resp, err := c.Client.IsDestroyer(ctx, &empty.Empty{}) - if err != nil { - return false, err - } - - return resp.Implements, nil -} - -func (c *destroyerClient) DestroyFunc() interface{} { - impl, err := c.Implements(context.Background()) - if err != nil { - return funcErr(err) - } - if !impl { - return nil - } - - // Get the spec - spec, err := c.Client.DestroySpec(context.Background(), &empty.Empty{}) - if err != nil { - return funcErr(err) - } - - return funcspec.Func(spec, c.destroy, - argmapper.Logger(c.Logger), - argmapper.Typed(&pluginargs.Internal{ - Broker: c.Broker, - Mappers: c.Mappers, - Cleanup: &pluginargs.Cleanup{}, - }), - ) -} - -func (c *destroyerClient) destroy( - ctx context.Context, - args funcspec.Args, - internal *pluginargs.Internal, -) error { - // Run the cleanup - defer internal.Cleanup.Close() - - // Call our function - _, err := c.Client.Destroy(ctx, &pb.FuncSpec_Args{Args: args}) - return err -} - -// destroyerServer implements the common Destroyer-related RPC calls. -// This should be embedded into the service implementation. -type destroyerServer struct { - *base - Impl interface{} -} - -func (s *destroyerServer) IsDestroyer( - ctx context.Context, - empty *empty.Empty, -) (*pb.ImplementsResp, error) { - d, ok := s.Impl.(component.Destroyer) - return &pb.ImplementsResp{ - Implements: ok && d.DestroyFunc() != nil, - }, nil -} - -func (s *destroyerServer) DestroySpec( - ctx context.Context, - args *empty.Empty, -) (*pb.FuncSpec, error) { - return funcspec.Spec(s.Impl.(component.Destroyer).DestroyFunc(), - //argmapper.WithNoOutput(), // we only expect an error value so ignore the rest - argmapper.ConverterFunc(s.Mappers...), - argmapper.Logger(s.Logger), - argmapper.Typed(s.internal()), - ) -} - -func (s *destroyerServer) Destroy( - ctx context.Context, - args *pb.FuncSpec_Args, -) (*empty.Empty, error) { - internal := s.internal() - defer internal.Cleanup.Close() - - _, err := callDynamicFunc2(s.Impl.(component.Destroyer).DestroyFunc(), args.Args, - argmapper.ConverterFunc(s.Mappers...), - argmapper.Typed(internal), - argmapper.Typed(ctx), - ) - if err != nil { - return nil, err - } - - return &empty.Empty{}, nil -} - -// destroyerProtoClient is the interface we expect any gRPC service that -// supports destroy to implement. -type destroyerProtoClient interface { - IsDestroyer(context.Context, *empty.Empty, ...grpc.CallOption) (*pb.ImplementsResp, error) - DestroySpec(context.Context, *empty.Empty, ...grpc.CallOption) (*pb.FuncSpec, error) - Destroy(context.Context, *pb.FuncSpec_Args, ...grpc.CallOption) (*empty.Empty, error) -} - -var ( - _ component.Destroyer = (*destroyerClient)(nil) -) diff --git a/sdk/internal/plugin/destroyer_workspace.go b/sdk/internal/plugin/destroyer_workspace.go deleted file mode 100644 index 55be09b45dc..00000000000 --- a/sdk/internal/plugin/destroyer_workspace.go +++ /dev/null @@ -1,136 +0,0 @@ -package plugin - -import ( - "context" - - "github.com/golang/protobuf/ptypes/empty" - "github.com/hashicorp/go-argmapper" - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" - "google.golang.org/grpc" - - "github.com/hashicorp/waypoint/sdk/component" - "github.com/hashicorp/waypoint/sdk/internal/funcspec" - "github.com/hashicorp/waypoint/sdk/internal/pluginargs" - pb "github.com/hashicorp/waypoint/sdk/proto" -) - -// workspaceDestroyerClient implements component.WorkspaceDestroyer for a service that -// has the destroy methods implemented. -type workspaceDestroyerClient struct { - Client workspaceDestroyerProtoClient - Logger hclog.Logger - Broker *plugin.GRPCBroker - Mappers []*argmapper.Func -} - -func (c *workspaceDestroyerClient) Implements(ctx context.Context) (bool, error) { - if c == nil { - return false, nil - } - - resp, err := c.Client.IsWorkspaceDestroyer(ctx, &empty.Empty{}) - if err != nil { - return false, err - } - - return resp.Implements, nil -} - -func (c *workspaceDestroyerClient) DestroyWorkspaceFunc() interface{} { - impl, err := c.Implements(context.Background()) - if err != nil { - return funcErr(err) - } - if !impl { - return nil - } - - // Get the spec - spec, err := c.Client.DestroyWorkspaceSpec(context.Background(), &empty.Empty{}) - if err != nil { - return funcErr(err) - } - - return funcspec.Func(spec, c.destroy, - argmapper.Logger(c.Logger), - argmapper.Typed(&pluginargs.Internal{ - Broker: c.Broker, - Mappers: c.Mappers, - Cleanup: &pluginargs.Cleanup{}, - }), - ) -} - -func (c *workspaceDestroyerClient) destroy( - ctx context.Context, - args funcspec.Args, - internal *pluginargs.Internal, -) error { - // Run the cleanup - defer internal.Cleanup.Close() - - // Call our function - _, err := c.Client.DestroyWorkspace(ctx, &pb.FuncSpec_Args{Args: args}) - return err -} - -// workspaceDestroyerServer implements the common WorkspaceDestroyer-related RPC calls. -// This should be embedded into the service implementation. -type workspaceDestroyerServer struct { - *base - Impl interface{} -} - -func (s *workspaceDestroyerServer) IsWorkspaceDestroyer( - ctx context.Context, - empty *empty.Empty, -) (*pb.ImplementsResp, error) { - d, ok := s.Impl.(component.WorkspaceDestroyer) - return &pb.ImplementsResp{ - Implements: ok && d.DestroyWorkspaceFunc() != nil, - }, nil -} - -func (s *workspaceDestroyerServer) DestroyWorkspaceSpec( - ctx context.Context, - args *empty.Empty, -) (*pb.FuncSpec, error) { - return funcspec.Spec(s.Impl.(component.WorkspaceDestroyer).DestroyWorkspaceFunc(), - //argmapper.WithNoOutput(), // we only expect an error value so ignore the rest - argmapper.ConverterFunc(s.Mappers...), - argmapper.Logger(s.Logger), - argmapper.Typed(s.internal()), - ) -} - -func (s *workspaceDestroyerServer) DestroyWorkspace( - ctx context.Context, - args *pb.FuncSpec_Args, -) (*empty.Empty, error) { - internal := s.internal() - defer internal.Cleanup.Close() - - _, err := callDynamicFunc2(s.Impl.(component.WorkspaceDestroyer).DestroyWorkspaceFunc(), args.Args, - argmapper.ConverterFunc(s.Mappers...), - argmapper.Typed(internal), - argmapper.Typed(ctx), - ) - if err != nil { - return nil, err - } - - return &empty.Empty{}, nil -} - -// workspaceDestroyerProtoClient is the interface we expect any gRPC service that -// supports destroy to implement. -type workspaceDestroyerProtoClient interface { - IsWorkspaceDestroyer(context.Context, *empty.Empty, ...grpc.CallOption) (*pb.ImplementsResp, error) - DestroyWorkspaceSpec(context.Context, *empty.Empty, ...grpc.CallOption) (*pb.FuncSpec, error) - DestroyWorkspace(context.Context, *pb.FuncSpec_Args, ...grpc.CallOption) (*empty.Empty, error) -} - -var ( - _ component.WorkspaceDestroyer = (*workspaceDestroyerClient)(nil) -) diff --git a/sdk/internal/plugin/dynamic_call.go b/sdk/internal/plugin/dynamic_call.go deleted file mode 100644 index 194159a74d1..00000000000 --- a/sdk/internal/plugin/dynamic_call.go +++ /dev/null @@ -1,94 +0,0 @@ -package plugin - -import ( - "fmt" - "reflect" - - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes" - "github.com/golang/protobuf/ptypes/any" - "github.com/hashicorp/go-argmapper" - - "github.com/hashicorp/waypoint/sdk/internal/funcspec" -) - -// callDynamicFunc calls a dynamic (mapper-based) function with the -// given input arguments. This is a helper that is expected to be used -// by most component gRPC servers to implement their function calls. -func callDynamicFunc2( - f interface{}, - args funcspec.Args, - callArgs ...argmapper.Arg, -) (interface{}, error) { - // Decode our *any.Any values. - for _, arg := range args { - anyVal := arg.Value - - name, err := ptypes.AnyMessageName(anyVal) - if err != nil { - return nil, err - } - - typ := proto.MessageType(name) - if typ == nil { - return nil, fmt.Errorf("cannot decode type: %s", name) - } - - // Allocate the message type. If it is a pointer we want to - // allocate the actual structure and not the pointer to the structure. - if typ.Kind() == reflect.Ptr { - typ = typ.Elem() - } - v := reflect.New(typ) - v.Elem().Set(reflect.Zero(typ)) - - // Unmarshal directly into our newly allocated structure. - if err := ptypes.UnmarshalAny(anyVal, v.Interface().(proto.Message)); err != nil { - return nil, err - } - - callArgs = append(callArgs, - argmapper.NamedSubtype(arg.Name, v.Interface(), arg.Type), - ) - } - - mapF, err := argmapper.NewFunc(f) - if err != nil { - return nil, err - } - - result := mapF.Call(callArgs...) - if err := result.Err(); err != nil { - return nil, err - } - - return result.Out(0), nil -} - -// callDynamicFuncAny is callDynamicFunc that automatically encodes the -// result to an *any.Any. -func callDynamicFuncAny2( - f interface{}, - args funcspec.Args, - callArgs ...argmapper.Arg, -) (*any.Any, interface{}, error) { - result, err := callDynamicFunc2(f, args, callArgs...) - if err != nil { - return nil, nil, err - } - - // We expect the final result to always be a proto message so we can - // send it back over the wire. - // - // NOTE(mitchellh): If we wanted to in the future, we can probably change - // this to be any type that has a mapper that can take it to be a - // proto.Message. - msg, ok := result.(proto.Message) - if !ok { - return nil, nil, fmt.Errorf( - "result of plugin-based function must be a proto.Message, got %T", msg) - } - - anyVal, err := ptypes.MarshalAny(msg) - return anyVal, result, err -} diff --git a/sdk/internal/plugin/error.go b/sdk/internal/plugin/error.go deleted file mode 100644 index c8b5a71c0b5..00000000000 --- a/sdk/internal/plugin/error.go +++ /dev/null @@ -1,14 +0,0 @@ -package plugin - -import ( - "context" -) - -// funcErr returns a function that can be returned for any of the -// Func component calls that just returns an error. This lets us surface -// RPC errors cleanly rather than a panic. -func funcErr(err error) interface{} { - return func(context.Context) (interface{}, error) { - return nil, err - } -} diff --git a/sdk/internal/plugin/history/history.go b/sdk/internal/plugin/history/history.go deleted file mode 100644 index 250b810a6be..00000000000 --- a/sdk/internal/plugin/history/history.go +++ /dev/null @@ -1,104 +0,0 @@ -package history - -import ( - "context" - - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" - "github.com/hashicorp/go-argmapper" - "google.golang.org/grpc" - - "github.com/hashicorp/waypoint/sdk/component" - "github.com/hashicorp/waypoint/sdk/history" - pb "github.com/hashicorp/waypoint/sdk/proto" -) - -// HistoryPlugin implements plugin.Plugin (specifically GRPCPlugin) for -// the History component type. -type HistoryPlugin struct { - plugin.NetRPCUnsupportedPlugin - - Impl history.Client // Impl is the concrete implementation - Mappers []*argmapper.Func // Mappers - Logger hclog.Logger // Logger -} - -func (p *HistoryPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error { - pb.RegisterHistoryServiceServer(s, &historyServer{ - Impl: p.Impl, - Mappers: p.Mappers, - Logger: p.Logger, - }) - return nil -} - -func (p *HistoryPlugin) GRPCClient( - ctx context.Context, - broker *plugin.GRPCBroker, - c *grpc.ClientConn, -) (interface{}, error) { - return &historyClient{ - client: pb.NewHistoryServiceClient(c), - logger: p.Logger, - mappers: p.Mappers, - }, nil -} - -// historyClient is an implementation of component.History that -// communicates over gRPC. -type historyClient struct { - client pb.HistoryServiceClient - logger hclog.Logger - mappers []*argmapper.Func -} - -func (c *historyClient) Deployments( - ctx context.Context, - cfg *history.Lookup, -) ([]component.Deployment, error) { - // Call it - resp, err := c.client.Deployments(ctx, LookupToProto(cfg)) - if err != nil { - return nil, err - } - - // Decode our slice - var result []component.Deployment - if err := unmarshalSlice(resp.Results, &result); err != nil { - return nil, err - } - - return result, nil -} - -// historyServer is a gRPC server that the client talks to and calls a -// real implementation of the component. -type historyServer struct { - Impl history.Client - Mappers []*argmapper.Func - Logger hclog.Logger -} - -func (s *historyServer) Deployments( - ctx context.Context, - args *pb.History_LookupRequest, -) (*pb.History_LookupResponse, error) { - result, err := s.Impl.Deployments(ctx, LookupFromProto(args)) - if err != nil { - return nil, err - } - - encoded, err := component.ProtoAnySlice(result) - if err != nil { - return nil, err - } - - return &pb.History_LookupResponse{Results: encoded}, nil -} - -var ( - _ plugin.Plugin = (*HistoryPlugin)(nil) - _ plugin.GRPCPlugin = (*HistoryPlugin)(nil) - _ pb.HistoryServiceServer = (*historyServer)(nil) - _ history.Client = (*historyClient)(nil) -) diff --git a/sdk/internal/plugin/history/lookup.go b/sdk/internal/plugin/history/lookup.go deleted file mode 100644 index 1da6ed01729..00000000000 --- a/sdk/internal/plugin/history/lookup.go +++ /dev/null @@ -1,26 +0,0 @@ -package history - -import ( - "github.com/hashicorp/waypoint/sdk/history" - pb "github.com/hashicorp/waypoint/sdk/proto" -) - -// LookupToProto converts a history.Lookup to the proto value. -func LookupToProto(req *history.Lookup) *pb.History_LookupRequest { - if req == nil { - req = &history.Lookup{} - } - - return &pb.History_LookupRequest{ - Limit: int32(req.Limit), - FilterStatus: pb.History_LookupRequest_FilterStatus(req.FilterStatus), - } -} - -// LookupFromProto converts a history.Lookup to the proto value. -func LookupFromProto(req *pb.History_LookupRequest) *history.Lookup { - return &history.Lookup{ - Limit: int(req.Limit), - FilterStatus: history.FilterStatus(req.FilterStatus), - } -} diff --git a/sdk/internal/plugin/history/proto.go b/sdk/internal/plugin/history/proto.go deleted file mode 100644 index aeec1f636b9..00000000000 --- a/sdk/internal/plugin/history/proto.go +++ /dev/null @@ -1,59 +0,0 @@ -package history - -import ( - "fmt" - "reflect" - - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes" - "github.com/golang/protobuf/ptypes/any" - - "github.com/hashicorp/waypoint/sdk/component" -) - -func unmarshalSlice(in, out interface{}) error { - outVal := reflect.ValueOf(out) - - inVal := reflect.ValueOf(in) - for i := 0; i < inVal.Len(); i++ { - raw := inVal.Index(i).Interface() - - // Get our proto out - if pm, ok := raw.(component.ProtoMarshaler); ok { - raw = pm.Proto() - } - - // We expect an *any.Any directly. - av, ok := raw.(*any.Any) - if !ok { - return fmt.Errorf("non-Any value found in slice: %#v", raw) - } - - name, err := ptypes.AnyMessageName(av) - if err != nil { - return err - } - - typ := proto.MessageType(name) - if typ == nil { - return fmt.Errorf("cannot decode type: %s", name) - } - - // Allocate the message type. If it is a pointer we want to - // allocate the actual structure and not the pointer to the structure. - if typ.Kind() == reflect.Ptr { - typ = typ.Elem() - } - v := reflect.New(typ) - v.Elem().Set(reflect.Zero(typ)) - - // Unmarshal directly into our newly allocated structure. - if err := ptypes.UnmarshalAny(av, v.Interface().(proto.Message)); err != nil { - return err - } - - outVal.Elem().Set(reflect.Append(outVal.Elem(), v)) - } - - return nil -} diff --git a/sdk/internal/plugin/log_viewer.go b/sdk/internal/plugin/log_viewer.go deleted file mode 100644 index 849e4310a20..00000000000 --- a/sdk/internal/plugin/log_viewer.go +++ /dev/null @@ -1,86 +0,0 @@ -package plugin - -import ( - "context" - - "github.com/golang/protobuf/ptypes" - "github.com/golang/protobuf/ptypes/empty" - "github.com/hashicorp/go-hclog" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/hashicorp/waypoint/sdk/component" - pb "github.com/hashicorp/waypoint/sdk/proto" -) - -// logViewerClient is an implementation of component.LogViewer over gRPC. -type logViewerClient struct { - Client pb.LogViewerClient - Logger hclog.Logger -} - -func (c *logViewerClient) NextLogBatch(ctx context.Context) ([]component.LogEvent, error) { - resp, err := c.Client.NextLogBatch(ctx, &empty.Empty{}) - if err != nil { - return nil, err - } - - var events []component.LogEvent - for _, event := range resp.Events { - ts, err := ptypes.Timestamp(event.Timestamp) - if err != nil { - // This is only possible with a poorly behaved plugin because - // the plugin must've converted a timestamp propertly to this format. - return nil, err - } - - events = append(events, component.LogEvent{ - Partition: event.Partition, - Timestamp: ts, - Message: event.Contents, - }) - } - - return events, nil -} - -// logViewerServer is a gRPC server that the client talks to and calls a -// real implementation of the component. -type logViewerServer struct { - Impl component.LogViewer - Logger hclog.Logger -} - -func (s *logViewerServer) NextLogBatch( - ctx context.Context, - args *empty.Empty, -) (*pb.Logs_NextBatchResp, error) { - events, err := s.Impl.NextLogBatch(ctx) - if err != nil { - return nil, err - } - - var result pb.Logs_NextBatchResp - for _, event := range events { - ts, err := ptypes.TimestampProto(event.Timestamp) - if err != nil { - return nil, status.Errorf( - codes.Internal, - "log entry has invalid timestamp: %s", - err) - } - - result.Events = append(result.Events, &pb.Logs_Event{ - Partition: event.Partition, - Timestamp: ts, - Contents: event.Message, - }) - } - - return &result, nil -} - -var ( - _ pb.LogViewerServer = (*logViewerServer)(nil) - _ component.LogViewer = (*logViewerClient)(nil) -) diff --git a/sdk/internal/plugin/logs.go b/sdk/internal/plugin/logs.go deleted file mode 100644 index 29b6db656b3..00000000000 --- a/sdk/internal/plugin/logs.go +++ /dev/null @@ -1,157 +0,0 @@ -package plugin - -import ( - "context" - "reflect" - - "github.com/golang/protobuf/ptypes/empty" - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" - "github.com/hashicorp/go-argmapper" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/hashicorp/waypoint/sdk/component" - "github.com/hashicorp/waypoint/sdk/internal/funcspec" - "github.com/hashicorp/waypoint/sdk/proto" -) - -// LogPlatformPlugin implements plugin.Plugin (specifically GRPCPlugin) for -// the LogPlatform component type. -type LogPlatformPlugin struct { - plugin.NetRPCUnsupportedPlugin - - Impl component.LogPlatform // Impl is the concrete implementation - Mappers []*argmapper.Func // Mappers - Logger hclog.Logger // Logger -} - -func (p *LogPlatformPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error { - proto.RegisterLogPlatformServer(s, &logPlatformServer{ - Impl: p.Impl, - Mappers: p.Mappers, - Logger: p.Logger, - Broker: broker, - }) - return nil -} - -func (p *LogPlatformPlugin) GRPCClient( - ctx context.Context, - broker *plugin.GRPCBroker, - c *grpc.ClientConn, -) (interface{}, error) { - return &logPlatformClient{ - client: proto.NewLogPlatformClient(c), - logger: p.Logger, - broker: broker, - }, nil -} - -// logPlatformClient is an implementation of component.LogPlatform over gRPC. -type logPlatformClient struct { - client proto.LogPlatformClient - logger hclog.Logger - broker *plugin.GRPCBroker -} - -func (c *logPlatformClient) LogsFunc() interface{} { - // Get the spec - spec, err := c.client.LogsSpec(context.Background(), &empty.Empty{}) - if err != nil { - return funcErr(err) - } - - // We don't want to be a mapper - spec.Result = nil - - return funcspec.Func(spec, c.logs, argmapper.Logger(c.logger)) -} - -func (c *logPlatformClient) logs( - ctx context.Context, - args funcspec.Args, -) (component.LogViewer, error) { - // Call our function - resp, err := c.client.Logs(ctx, &proto.FuncSpec_Args{Args: args}) - if err != nil { - return nil, err - } - - // Get the stream ID and connect to it - conn, err := c.broker.Dial(resp.StreamId) - if err != nil { - return nil, err - } - - return &logViewerClient{ - Client: proto.NewLogViewerClient(conn), - Logger: c.logger.Named("logviewer"), - }, nil -} - -// logPlatformServer is a gRPC server that the client talks to and calls a -// real implementation of the component. -type logPlatformServer struct { - Impl component.LogPlatform - Mappers []*argmapper.Func - Logger hclog.Logger - Broker *plugin.GRPCBroker -} - -func (s *logPlatformServer) LogsSpec( - ctx context.Context, - args *empty.Empty, -) (*proto.FuncSpec, error) { - return funcspec.Spec(s.Impl.LogsFunc(), - argmapper.ConverterFunc(s.Mappers...), - argmapper.Logger(s.Logger), - - // We expect a component.LogViewer output type and not a proto.Message - argmapper.FilterOutput(argmapper.FilterType( - reflect.TypeOf((*component.LogViewer)(nil)).Elem()), - ), - ) -} - -func (s *logPlatformServer) Logs( - ctx context.Context, - args *proto.FuncSpec_Args, -) (*proto.Logs_Resp, error) { - result, err := callDynamicFunc2(s.Impl.LogsFunc(), args.Args, - argmapper.Typed(ctx), - argmapper.ConverterFunc(s.Mappers...)) - if err != nil { - return nil, err - } - - lv, ok := result.(component.LogViewer) - if !ok { - return nil, status.Errorf(codes.FailedPrecondition, - "plugin Logs function should've returned a component.LogViewer, got %T", - result) - } - - // Get the ID for the server we're going to start to run our viewer - id := s.Broker.NextId() - - // Start our server - go s.Broker.AcceptAndServe(id, func(opts []grpc.ServerOption) *grpc.Server { - server := plugin.DefaultGRPCServer(opts) - proto.RegisterLogViewerServer(server, &logViewerServer{ - Impl: lv, - Logger: s.Logger.Named("logviewer"), - }) - return server - }) - - return &proto.Logs_Resp{StreamId: id}, nil -} - -var ( - _ plugin.Plugin = (*LogPlatformPlugin)(nil) - _ plugin.GRPCPlugin = (*LogPlatformPlugin)(nil) - _ proto.LogPlatformServer = (*logPlatformServer)(nil) - _ component.LogPlatform = (*logPlatformClient)(nil) -) diff --git a/sdk/internal/plugin/logs_test.go b/sdk/internal/plugin/logs_test.go deleted file mode 100644 index e3e2f0ef839..00000000000 --- a/sdk/internal/plugin/logs_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package plugin - -import ( - "context" - "testing" - "time" - - "github.com/hashicorp/go-plugin" - "github.com/hashicorp/go-argmapper" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - - "github.com/hashicorp/waypoint/sdk/component" - "github.com/hashicorp/waypoint/sdk/component/mocks" - "github.com/hashicorp/waypoint/sdk/proto" -) - -func TestLogPlatformLogs(t *testing.T) { - require := require.New(t) - - expected := []component.LogEvent{component.LogEvent{ - Partition: "foo", - Timestamp: time.Now(), - Message: "hello", - }} - mockLV := &mocks.LogViewer{} - mockLV.On("NextLogBatch", mock.Anything).Return(expected, nil) - - logsFunc := func(ctx context.Context, args *component.Source) component.LogViewer { - return mockLV - } - - mockLP := &mocks.LogPlatform{} - mockLP.On("LogsFunc").Return(logsFunc) - - plugins := Plugins(WithComponents(mockLP), WithMappers(testDefaultMappers(t)...)) - client, server := plugin.TestPluginGRPCConn(t, plugins[1]) - defer client.Close() - defer server.Stop() - - raw, err := client.Dispense("log_platform") - require.NoError(err) - lp := raw.(component.LogPlatform) - f := lp.LogsFunc().(*argmapper.Func) - require.NotNil(f) - - result := f.Call( - argmapper.Typed(context.Background()), - argmapper.Typed(&proto.Args_Source{App: "foo"}), - ) - require.NoError(result.Err()) - - raw = result.Out(0) - require.NotNil(raw) - - value := raw.(component.LogViewer) - require.NotNil(value) - - entries, err := value.NextLogBatch(context.Background()) - require.NoError(err) - require.Len(entries, 1) - require.Equal(expected[0].Message, entries[0].Message) -} diff --git a/sdk/internal/plugin/mapper.go b/sdk/internal/plugin/mapper.go deleted file mode 100644 index 919ad34557c..00000000000 --- a/sdk/internal/plugin/mapper.go +++ /dev/null @@ -1,183 +0,0 @@ -package plugin - -import ( - "context" - "reflect" - - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes/any" - "github.com/golang/protobuf/ptypes/empty" - "github.com/hashicorp/go-argmapper" - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/hashicorp/waypoint/sdk/internal-shared/protomappers" - "github.com/hashicorp/waypoint/sdk/internal/funcspec" - pb "github.com/hashicorp/waypoint/sdk/proto" -) - -// MapperPlugin implements plugin.Plugin (specifically GRPCPlugin) for -// the Mapper plugin type. -type MapperPlugin struct { - plugin.NetRPCUnsupportedPlugin - - Mappers []*argmapper.Func // Mappers - Logger hclog.Logger // Logger -} - -func (p *MapperPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error { - pb.RegisterMapperServer(s, &mapperServer{ - Mappers: p.Mappers, - Logger: p.Logger, - }) - return nil -} - -func (p *MapperPlugin) GRPCClient( - ctx context.Context, - broker *plugin.GRPCBroker, - c *grpc.ClientConn, -) (interface{}, error) { - return &MapperClient{ - client: pb.NewMapperClient(c), - logger: p.Logger, - }, nil -} - -// MapperClient is an implementation of component.Mapper over gRPC. -type MapperClient struct { - client pb.MapperClient - logger hclog.Logger -} - -// Mappers returns the list of mappers that are supported by this plugin. -func (c *MapperClient) Mappers() ([]*argmapper.Func, error) { - // Get our list of mapper FuncSpecs - resp, err := c.client.ListMappers(context.Background(), &empty.Empty{}) - if err != nil { - return nil, err - } - - // For each FuncSpec we turn that into a real mapper.Func which calls back - // into our clien to make an RPC call to generate the proper type. - var funcs []*argmapper.Func - for _, spec := range resp.Funcs { - specCopy := spec - - // We use a closure here to capture spec so that we can provide - // the correct result type. All we're doing is making our callback - // call the Map RPC call and return the result/error. - cb := func(ctx context.Context, args funcspec.Args) (*any.Any, error) { - resp, err := c.client.Map(ctx, &pb.Map_Request{ - Args: &pb.FuncSpec_Args{Args: args}, - Result: specCopy.Result[0].Type, - }) - if err != nil { - return nil, err - } - - return resp.Result, nil - } - - // Build our funcspec function - f := funcspec.Func(specCopy, cb, argmapper.Logger(c.logger)) - - // Accumulate our functions - funcs = append(funcs, f) - } - - return funcs, nil -} - -// mapperServer is a gRPC server that implements the Mapper service. -type mapperServer struct { - Mappers []*argmapper.Func - Logger hclog.Logger -} - -func (s *mapperServer) ListMappers( - ctx context.Context, - empty *empty.Empty, -) (*pb.Map_ListResponse, error) { - // Go through each mapper and build up our FuncSpecs for each of them. - var result pb.Map_ListResponse - for _, m := range s.Mappers { - fn := m.Func() - - // Skip our built-in protomappers - if _, ok := protomapperAllMap[reflect.ValueOf(fn).Type()]; ok { - continue - } - - spec, err := funcspec.Spec(fn, - argmapper.ConverterFunc(s.Mappers...), - argmapper.Logger(s.Logger)) - if err != nil { - s.Logger.Warn( - "error converting mapper, will not notify plugin host", - "func", m.String(), - "err", err, - ) - continue - } - - result.Funcs = append(result.Funcs, spec) - } - - return &result, nil -} - -func (s *mapperServer) Map( - ctx context.Context, - args *pb.Map_Request, -) (*pb.Map_Response, error) { - // Find the output type, which we should know about. - typ := proto.MessageType(args.Result) - if typ == nil { - return nil, status.Newf( - codes.FailedPrecondition, - "output type is not known: %s", - args.Result, - ).Err() - } - - // Build our function that expects this type as an argument - // so that we can return it. We do this dynamic function thing so - // that we can just pretend that this is a function we have so that - // callDynamicFunc just works. - f := reflect.MakeFunc( - reflect.FuncOf([]reflect.Type{typ}, []reflect.Type{typ}, false), - func(args []reflect.Value) []reflect.Value { - return args - }, - ).Interface() - - // Call it! - result, _, err := callDynamicFuncAny2(f, args.Args.Args, - argmapper.Typed(ctx), - argmapper.ConverterFunc(s.Mappers...), - ) - if err != nil { - return nil, err - } - return &pb.Map_Response{Result: result}, nil -} - -var ( - _ plugin.Plugin = (*MapperPlugin)(nil) - _ plugin.GRPCPlugin = (*MapperPlugin)(nil) - _ pb.MapperServer = (*mapperServer)(nil) - - // protomapperAllMap is a set of all the protomapper mappers so - // that we can easily filter them in ListMappers. - protomapperAllMap = map[reflect.Type]struct{}{} -) - -func init() { - for _, f := range protomappers.All { - protomapperAllMap[reflect.TypeOf(f)] = struct{}{} - } -} diff --git a/sdk/internal/plugin/mapper_test.go b/sdk/internal/plugin/mapper_test.go deleted file mode 100644 index 3f98eecab49..00000000000 --- a/sdk/internal/plugin/mapper_test.go +++ /dev/null @@ -1,74 +0,0 @@ -package plugin - -import ( - "context" - "testing" - - "github.com/hashicorp/go-plugin" - "github.com/hashicorp/go-argmapper" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/hashicorp/waypoint/sdk/internal/funcspec" - "github.com/hashicorp/waypoint/sdk/internal/testproto" - pb "github.com/hashicorp/waypoint/sdk/proto" -) - -func TestMapperClient(t *testing.T) { - require := require.New(t) - assert := assert.New(t) - - mA, err := argmapper.NewFunc(func(a *testproto.A) *testproto.B { - return &testproto.B{Value: a.Value + 1} - }) - require.NoError(err) - - plugins := Plugins(WithMappers(append(testDefaultMappers(t), mA)...)) - client, server := plugin.TestPluginGRPCConn(t, plugins[1]) - defer client.Close() - defer server.Stop() - - raw, err := client.Dispense("mapper") - require.NoError(err) - mapper := raw.(*MapperClient) - - mappers, err := mapper.Mappers() - require.NoError(err) - require.NotEmpty(mappers) - - targetSpec := &pb.FuncSpec{ - Args: []*pb.FuncSpec_Value{ - &pb.FuncSpec_Value{ - Type: "testproto.B", - }, - }, - - Result: []*pb.FuncSpec_Value{ - &pb.FuncSpec_Value{ - Type: "testproto.Data", - }, - }, - } - - called := false - target := funcspec.Func(targetSpec, func(args funcspec.Args) (interface{}, error) { - cb := func(v *testproto.B) *testproto.Data { - called = true - assert.Equal(int32(2), v.Value) - return &testproto.Data{} - } - - return callDynamicFunc2(cb, args, - argmapper.Typed(context.Background()), - argmapper.ConverterFunc(mappers...), - ) - }) - - result := target.Call( - argmapper.Typed(context.Background()), - argmapper.Typed(&testproto.A{Value: 1}), - argmapper.ConverterFunc(mappers...), - ) - require.NoError(result.Err()) - require.True(called) -} diff --git a/sdk/internal/plugin/platform.go b/sdk/internal/plugin/platform.go deleted file mode 100644 index a4f9dc66e35..00000000000 --- a/sdk/internal/plugin/platform.go +++ /dev/null @@ -1,458 +0,0 @@ -package plugin - -import ( - "context" - "reflect" - - "github.com/davecgh/go-spew/spew" - "github.com/golang/protobuf/ptypes/empty" - "github.com/hashicorp/go-argmapper" - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/hashicorp/waypoint/sdk/component" - "github.com/hashicorp/waypoint/sdk/docs" - "github.com/hashicorp/waypoint/sdk/internal/funcspec" - "github.com/hashicorp/waypoint/sdk/internal/pluginargs" - "github.com/hashicorp/waypoint/sdk/internal/plugincomponent" - "github.com/hashicorp/waypoint/sdk/proto" -) - -// PlatformPlugin implements plugin.Plugin (specifically GRPCPlugin) for -// the Platform component type. -type PlatformPlugin struct { - plugin.NetRPCUnsupportedPlugin - - Impl component.Platform // Impl is the concrete implementation - Mappers []*argmapper.Func // Mappers - Logger hclog.Logger // Logger -} - -func (p *PlatformPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error { - base := &base{ - Mappers: p.Mappers, - Logger: p.Logger, - Broker: broker, - } - - proto.RegisterPlatformServer(s, &platformServer{ - base: base, - destroyerServer: &destroyerServer{ - base: base, - Impl: p.Impl, - }, - workspaceDestroyerServer: &workspaceDestroyerServer{ - base: base, - Impl: p.Impl, - }, - - authenticatorServer: &authenticatorServer{ - base: base, - Impl: p.Impl, - }, - - Impl: p.Impl, - }) - - return nil -} - -func (p *PlatformPlugin) GRPCClient( - ctx context.Context, - broker *plugin.GRPCBroker, - c *grpc.ClientConn, -) (interface{}, error) { - // Build our client to the platform service - client := &platformClient{ - client: proto.NewPlatformClient(c), - logger: p.Logger, - broker: broker, - mappers: p.Mappers, - } - - // Check if we also implement the LogPlatform - var logPlatform component.LogPlatform - resp, err := client.client.IsLogPlatform(ctx, &empty.Empty{}) - if err != nil { - return nil, err - } - if resp.Implements { - raw, err := (&LogPlatformPlugin{ - Logger: p.Logger, - }).GRPCClient(ctx, broker, c) - if err != nil { - return nil, err - } - - p.Logger.Info("platform plugin capable of logs") - logPlatform = raw.(component.LogPlatform) - } - - // Compose destroyer - destroyer := &destroyerClient{ - Client: client.client, - Logger: client.logger, - Broker: client.broker, - Mappers: client.mappers, - } - if ok, err := destroyer.Implements(ctx); err != nil { - return nil, err - } else if ok { - p.Logger.Info("platform plugin capable of destroy") - } else { - destroyer = nil - } - - // Compose workspace destroyer - wsDestroyer := &workspaceDestroyerClient{ - Client: client.client, - Logger: client.logger, - Broker: client.broker, - Mappers: client.mappers, - } - if ok, err := wsDestroyer.Implements(ctx); err != nil { - return nil, err - } else if ok { - p.Logger.Info("platform plugin capable of destroy") - } else { - wsDestroyer = nil - } - - authenticator := &authenticatorClient{ - Client: client.client, - Logger: client.logger, - Broker: client.broker, - Mappers: client.mappers, - } - if ok, err := authenticator.Implements(ctx); err != nil { - return nil, err - } else if ok { - p.Logger.Info("platform plugin capable of auth") - } else { - authenticator = nil - } - - // Figure out what we're returning - var result interface{} = client - switch { - case logPlatform != nil && destroyer != nil: - result = &mix_Platform_Log_Destroy{ - Authenticator: authenticator, - ConfigurableNotify: client, - Platform: client, - PlatformReleaser: client, - LogPlatform: logPlatform, - Destroyer: destroyer, - WorkspaceDestroyer: wsDestroyer, - Documented: client, - } - - case logPlatform != nil: - result = &mix_Platform_Log{ - Authenticator: authenticator, - ConfigurableNotify: client, - Platform: client, - PlatformReleaser: client, - LogPlatform: logPlatform, - WorkspaceDestroyer: wsDestroyer, - Documented: client, - } - - case destroyer != nil: - result = &mix_Platform_Destroy{ - Authenticator: authenticator, - ConfigurableNotify: client, - Platform: client, - PlatformReleaser: client, - Destroyer: destroyer, - WorkspaceDestroyer: wsDestroyer, - Documented: client, - } - default: - result = &mix_Platform_Authenticator{ - Authenticator: authenticator, - ConfigurableNotify: client, - Platform: client, - PlatformReleaser: client, - WorkspaceDestroyer: wsDestroyer, - Documented: client, - } - } - - return result, nil -} - -// platformClient is an implementation of component.Platform over gRPC. -type platformClient struct { - client proto.PlatformClient - logger hclog.Logger - broker *plugin.GRPCBroker - mappers []*argmapper.Func -} - -func (c *platformClient) Config() (interface{}, error) { - return configStructCall(context.Background(), c.client) -} - -func (c *platformClient) ConfigSet(v interface{}) error { - return configureCall(context.Background(), c.client, v) -} - -func (c *platformClient) Documentation() (*docs.Documentation, error) { - return documentationCall(context.Background(), c.client) -} - -func (c *platformClient) DeployFunc() interface{} { - // Get the spec - spec, err := c.client.DeploySpec(context.Background(), &proto.Empty{}) - if err != nil { - return funcErr(err) - } - - // We don't want to be a mapper - spec.Result = nil - - return funcspec.Func(spec, c.deploy, - argmapper.Logger(c.logger), - argmapper.Typed(&pluginargs.Internal{ - Broker: c.broker, - Mappers: c.mappers, - Cleanup: &pluginargs.Cleanup{}, - }), - ) -} - -func (c *platformClient) deploy( - ctx context.Context, - args funcspec.Args, - internal *pluginargs.Internal, -) (component.Deployment, error) { - // Run the cleanup - defer internal.Cleanup.Close() - - // Call our function - resp, err := c.client.Deploy(ctx, &proto.FuncSpec_Args{Args: args}) - if err != nil { - return nil, err - } - - return &plugincomponent.Deployment{Any: resp.Result}, nil -} - -func (c *platformClient) DefaultReleaserFunc() interface{} { - // Get the spec. If it is unimplemented thats no big deal we can just - // return nil and the caller will handle this properly. - spec, err := c.client.DefaultReleaserSpec(context.Background(), &empty.Empty{}) - if status.Code(err) == codes.Unimplemented { - return nil - } - if err != nil { - return funcErr(err) - } - - // We don't want to be a mapper - spec.Result = nil - - return funcspec.Func(spec, c.defaultReleaser, - argmapper.Logger(c.logger), - argmapper.Typed(&pluginargs.Internal{ - Broker: c.broker, - Mappers: c.mappers, - Cleanup: &pluginargs.Cleanup{}, - }), - ) -} - -func (c *platformClient) defaultReleaser( - ctx context.Context, - args funcspec.Args, - internal *pluginargs.Internal, -) (component.ReleaseManager, error) { - // Run the cleanup - defer internal.Cleanup.Close() - - // Call our function - resp, err := c.client.DefaultReleaser(ctx, &proto.FuncSpec_Args{Args: args}) - if err != nil { - return nil, err - } - - // Get the stream ID and connect to it - conn, err := c.broker.Dial(resp.StreamId) - if err != nil { - return nil, err - } - - return &releaseManagerClient{ - client: proto.NewReleaseManagerClient(conn), - logger: c.logger.Named("releaser"), - broker: c.broker, - mappers: c.mappers, - }, nil -} - -// platformServer is a gRPC server that the client talks to and calls a -// real implementation of the component. -type platformServer struct { - *base - *destroyerServer - *workspaceDestroyerServer - *authenticatorServer - - Impl component.Platform -} - -func (s *platformServer) IsLogPlatform( - ctx context.Context, - empty *empty.Empty, -) (*proto.ImplementsResp, error) { - _, ok := s.Impl.(component.LogPlatform) - return &proto.ImplementsResp{Implements: ok}, nil -} - -func (s *platformServer) ConfigStruct( - ctx context.Context, - empty *empty.Empty, -) (*proto.Config_StructResp, error) { - return configStruct(s.Impl) -} - -func (s *platformServer) Configure( - ctx context.Context, - req *proto.Config_ConfigureRequest, -) (*empty.Empty, error) { - return configure(s.Impl, req) -} - -func (s *platformServer) Documentation( - ctx context.Context, - empty *empty.Empty, -) (*proto.Config_Documentation, error) { - docs, err := documentation(s.Impl) - - if docs != nil { - s.Logger.Debug("docs", "docs", spew.Sdump(docs)) - } - - return docs, err -} - -func (s *platformServer) DeploySpec( - ctx context.Context, - args *proto.Empty, -) (*proto.FuncSpec, error) { - if s.Impl == nil { - return nil, status.Errorf(codes.Unimplemented, "plugin does not implement: platform") - } - - return funcspec.Spec(s.Impl.DeployFunc(), - argmapper.ConverterFunc(s.Mappers...), - argmapper.Logger(s.Logger), - argmapper.Typed(s.internal()), - ) -} - -func (s *platformServer) Deploy( - ctx context.Context, - args *proto.FuncSpec_Args, -) (*proto.Deploy_Resp, error) { - internal := s.internal() - defer internal.Cleanup.Close() - - encoded, _, err := callDynamicFuncAny2(s.Impl.DeployFunc(), args.Args, - argmapper.ConverterFunc(s.Mappers...), - argmapper.Typed(internal), - argmapper.Typed(ctx), - ) - if err != nil { - return nil, err - } - - return &proto.Deploy_Resp{Result: encoded}, nil -} - -func (s *platformServer) DefaultReleaserSpec( - ctx context.Context, - args *empty.Empty, -) (*proto.FuncSpec, error) { - var f interface{} - if impl, ok := s.Impl.(component.PlatformReleaser); ok { - f = impl.DefaultReleaserFunc() - } - - // If there is no function, then we don't implement this. - if f == nil { - return nil, status.Errorf(codes.Unimplemented, "") - } - - return funcspec.Spec(f, - argmapper.ConverterFunc(s.Mappers...), - argmapper.Logger(s.Logger), - argmapper.Typed(s.internal()), - - // We expect a component.LogViewer output type and not a proto.Message - argmapper.FilterOutput(argmapper.FilterType( - reflect.TypeOf((*component.ReleaseManager)(nil)).Elem()), - ), - ) -} - -func (s *platformServer) DefaultReleaser( - ctx context.Context, - args *proto.FuncSpec_Args, -) (*proto.DefaultReleaser_Resp, error) { - internal := s.internal() - defer internal.Cleanup.Close() - - impl, ok := s.Impl.(component.PlatformReleaser) - if !ok { - return nil, status.Errorf(codes.Unimplemented, "") - } - - raw, err := callDynamicFunc2(impl.DefaultReleaserFunc(), args.Args, - argmapper.ConverterFunc(s.Mappers...), - argmapper.Typed(internal), - argmapper.Typed(ctx), - ) - if err != nil { - return nil, err - } - - releaser, ok := raw.(component.ReleaseManager) - if !ok || releaser == nil { - return nil, status.Errorf(codes.FailedPrecondition, - "plugin DefaultReleaser function should've returned a component.ReleaseManager, got %T", - raw) - } - - // Get the ID for the server we're going to start to run our viewer - id := s.Broker.NextId() - - // Start our server - go s.Broker.AcceptAndServe(id, func(opts []grpc.ServerOption) *grpc.Server { - base := *s.base - base.Logger = s.Logger.Named("releaser") - - server := plugin.DefaultGRPCServer(opts) - proto.RegisterReleaseManagerServer(server, &releaseManagerServer{ - Impl: releaser, - base: &base, - }) - return server - }) - - return &proto.DefaultReleaser_Resp{StreamId: id}, nil -} - -var ( - _ plugin.Plugin = (*PlatformPlugin)(nil) - _ plugin.GRPCPlugin = (*PlatformPlugin)(nil) - _ proto.PlatformServer = (*platformServer)(nil) - _ component.Platform = (*platformClient)(nil) - _ component.PlatformReleaser = (*platformClient)(nil) - _ component.Configurable = (*platformClient)(nil) - _ component.ConfigurableNotify = (*platformClient)(nil) -) diff --git a/sdk/internal/plugin/platform_mix.go b/sdk/internal/plugin/platform_mix.go deleted file mode 100644 index 178547da39c..00000000000 --- a/sdk/internal/plugin/platform_mix.go +++ /dev/null @@ -1,45 +0,0 @@ -package plugin - -import ( - "github.com/hashicorp/waypoint/sdk/component" -) - -type mix_Platform_Authenticator struct { - component.Authenticator - component.ConfigurableNotify - component.Documented - component.Platform - component.PlatformReleaser - component.WorkspaceDestroyer -} - -type mix_Platform_Destroy struct { - component.Authenticator - component.ConfigurableNotify - component.Documented - component.Platform - component.PlatformReleaser - component.Destroyer - component.WorkspaceDestroyer -} - -type mix_Platform_Log struct { - component.Authenticator - component.ConfigurableNotify - component.Documented - component.Platform - component.PlatformReleaser - component.LogPlatform - component.WorkspaceDestroyer -} - -type mix_Platform_Log_Destroy struct { - component.Authenticator - component.ConfigurableNotify - component.Documented - component.Platform - component.PlatformReleaser - component.LogPlatform - component.Destroyer - component.WorkspaceDestroyer -} diff --git a/sdk/internal/plugin/platform_test.go b/sdk/internal/plugin/platform_test.go deleted file mode 100644 index b6ecf958753..00000000000 --- a/sdk/internal/plugin/platform_test.go +++ /dev/null @@ -1,150 +0,0 @@ -package plugin - -import ( - "testing" - - "github.com/hashicorp/go-plugin" - "github.com/stretchr/testify/require" - - "github.com/hashicorp/waypoint/sdk/component" - "github.com/hashicorp/waypoint/sdk/component/mocks" -) - -func TestPlatform_optionalInterfaces(t *testing.T) { - t.Run("implements LogPlatform", func(t *testing.T) { - require := require.New(t) - - mockV := &mockPlatformLog{} - - plugins := Plugins(WithComponents(mockV), WithMappers(testDefaultMappers(t)...)) - client, server := plugin.TestPluginGRPCConn(t, plugins[1]) - defer client.Close() - defer server.Stop() - - raw, err := client.Dispense("platform") - require.NoError(err) - require.Implements((*component.Platform)(nil), raw) - require.Implements((*component.PlatformReleaser)(nil), raw) - require.Implements((*component.LogPlatform)(nil), raw) - - _, ok := raw.(component.Destroyer) - require.False(ok, "should not implement") - }) - - t.Run("doesn't implement LogPlatform", func(t *testing.T) { - require := require.New(t) - - mockV := &mocks.Platform{} - - plugins := Plugins(WithComponents(mockV), WithMappers(testDefaultMappers(t)...)) - client, server := plugin.TestPluginGRPCConn(t, plugins[1]) - defer client.Close() - defer server.Stop() - - raw, err := client.Dispense("platform") - require.NoError(err) - require.Implements((*component.Platform)(nil), raw) - - _, ok := raw.(component.LogPlatform) - require.False(ok, "does not implement LogPlatform") - - _, ok = raw.(component.Destroyer) - require.False(ok, "should not implement") - }) - - t.Run("implements Destroyer", func(t *testing.T) { - require := require.New(t) - - mockV := &mockPlatformDestroyer{} - mockV.Destroyer.On("DestroyFunc").Return(42) - - plugins := Plugins(WithComponents(mockV), WithMappers(testDefaultMappers(t)...)) - client, server := plugin.TestPluginGRPCConn(t, plugins[1]) - defer client.Close() - defer server.Stop() - - raw, err := client.Dispense("platform") - require.NoError(err) - require.Implements((*component.Platform)(nil), raw) - require.Implements((*component.Destroyer)(nil), raw) - - _, ok := raw.(component.LogPlatform) - require.False(ok, "does not implement LogPlatform") - }) - - t.Run("implements Authenticator", func(t *testing.T) { - require := require.New(t) - - mockV := &mockPlatformAuthenticator{} - - plugins := Plugins(WithComponents(mockV), WithMappers(testDefaultMappers(t)...)) - client, server := plugin.TestPluginGRPCConn(t, plugins[1]) - defer client.Close() - defer server.Stop() - - raw, err := client.Dispense("platform") - require.NoError(err) - require.Implements((*component.Platform)(nil), raw) - require.Implements((*component.Authenticator)(nil), raw) - - _, ok := raw.(component.LogPlatform) - require.False(ok, "does not implement LogPlatform") - }) -} - -func TestPlatformDynamicFunc_core(t *testing.T) { - testDynamicFunc(t, "platform", &mocks.Platform{}, func(v, f interface{}) { - v.(*mocks.Platform).On("DeployFunc").Return(f) - }, func(raw interface{}) interface{} { - return raw.(component.Platform).DeployFunc() - }) -} - -func TestPlatformDynamicFunc_destroy(t *testing.T) { - testDynamicFunc(t, "platform", &mockPlatformDestroyer{}, func(v, f interface{}) { - v.(*mockPlatformDestroyer).Destroyer.On("DestroyFunc").Return(f) - }, func(raw interface{}) interface{} { - return raw.(component.Destroyer).DestroyFunc() - }) -} - -func TestPlatformDynamicFunc_auth(t *testing.T) { - testDynamicFunc(t, "platform", &mockPlatformAuthenticator{}, func(v, f interface{}) { - v.(*mockPlatformAuthenticator).Authenticator.On("AuthFunc").Return(f) - }, func(raw interface{}) interface{} { - return raw.(component.Authenticator).AuthFunc() - }) -} - -func TestPlatformDynamicFunc_validateAuth(t *testing.T) { - testDynamicFunc(t, "platform", &mockPlatformAuthenticator{}, func(v, f interface{}) { - v.(*mockPlatformAuthenticator).Authenticator.On("ValidateAuthFunc").Return(f) - }, func(raw interface{}) interface{} { - return raw.(component.Authenticator).ValidateAuthFunc() - }) -} - -func TestPlatformConfig(t *testing.T) { - mockV := &mockPlatformConfigurable{} - testConfigurable(t, "platform", mockV, &mockV.Configurable) -} - -type mockPlatformAuthenticator struct { - mocks.Platform - mocks.Authenticator -} - -type mockPlatformConfigurable struct { - mocks.Platform - mocks.Configurable -} - -type mockPlatformLog struct { - mocks.Platform - mocks.LogPlatform -} - -type mockPlatformDestroyer struct { - mocks.Platform - mocks.Destroyer -} diff --git a/sdk/internal/plugin/plugin.go b/sdk/internal/plugin/plugin.go deleted file mode 100644 index 0928394c5d2..00000000000 --- a/sdk/internal/plugin/plugin.go +++ /dev/null @@ -1,134 +0,0 @@ -package plugin - -import ( - "fmt" - "reflect" - - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" - "github.com/hashicorp/go-argmapper" -) - -// Handshake is a common handshake that is shared by plugin and host. -var Handshake = plugin.HandshakeConfig{ - // Not secret, just to avoid plugins being launched manually. The - // cookie value is a random SHA256 via /dev/urandom. This cookie value - // must NEVER be changed or plugins will stop working. - MagicCookieKey: "WAYPOINT_PLUGIN", - MagicCookieValue: "be6c1928786a4df0222c13eef44ac846da2c0d461d99addc93f804601c6b7205", -} - -// Plugins returns the list of available plugins and initializes them with -// the given components. This will panic if an invalid component is given. -func Plugins(opts ...Option) map[int]plugin.PluginSet { - var c pluginConfig - for _, opt := range opts { - opt(&c) - } - - // If we have no logger, we use the default - if c.Logger == nil { - c.Logger = hclog.L() - } - - // Build our plugin types - result := map[int]plugin.PluginSet{ - 1: plugin.PluginSet{ - "mapper": &MapperPlugin{}, - "builder": &BuilderPlugin{}, - "platform": &PlatformPlugin{}, - "log_platform": &LogPlatformPlugin{}, - "registry": &RegistryPlugin{}, - "releasemanager": &ReleaseManagerPlugin{}, - }, - } - - // Set the various field values - for _, c := range c.Components { - if err := setFieldValue(result, c); err != nil { - panic(err) - } - } - - // Set the mappers - if err := setFieldValue(result, c.Mappers); err != nil { - panic(err) - } - // Set the logger - if err := setFieldValue(result, c.Logger); err != nil { - panic(err) - } - - return result -} - -// pluginConfig is used to configure Plugins via Option calls. -type pluginConfig struct { - Components []interface{} - Mappers []*argmapper.Func - Logger hclog.Logger -} - -// Option configures Plugins -type Option func(*pluginConfig) - -// WithComponents sets the components to configure for the plugins. -// This will append to the components. -func WithComponents(cs ...interface{}) Option { - return func(c *pluginConfig) { c.Components = append(c.Components, cs...) } -} - -// WithMappers sets the mappers to configure for the plugins. This will -// append to the existing mappers. -func WithMappers(ms ...*argmapper.Func) Option { - return func(c *pluginConfig) { - c.Mappers = append(c.Mappers, ms...) - } -} - -// WithLogger sets the logger for the plugins. -func WithLogger(log hclog.Logger) Option { - return func(c *pluginConfig) { c.Logger = log } -} - -// setFieldValue sets the given value c on any exported field of an available -// plugin that matches the type of c. An error is returned if c can't be -// assigned to ANY plugin type. -// -// preconditions: -// - plugins in m are pointers to structs -func setFieldValue(m map[int]plugin.PluginSet, c interface{}) error { - cv := reflect.ValueOf(c) - ct := cv.Type() - - // Go through each pluginset - once := false - for _, set := range m { - // Go through each plugin - for _, p := range set { - // Get the value, dereferencing the pointer. We expect - // the value to be &SomeStruct{} so we must deref once. - v := reflect.ValueOf(p).Elem() - - // Go through all the fields - for i := 0; i < v.NumField(); i++ { - f := v.Field(i) - - // If the field is valid and our component can be assigned - // to it then we set the value directly. We continue setting - // values because some values we set are available in multiple - // plugins (loggers for example). - if f.IsValid() && ct.AssignableTo(f.Type()) { - f.Set(cv) - once = true - } - } - } - } - - if !once { - return fmt.Errorf("no plugin available for setting field of type %T", c) - } - - return nil -} diff --git a/sdk/internal/plugin/plugin_test.go b/sdk/internal/plugin/plugin_test.go deleted file mode 100644 index 59327276113..00000000000 --- a/sdk/internal/plugin/plugin_test.go +++ /dev/null @@ -1,120 +0,0 @@ -package plugin - -import ( - "context" - "testing" - - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" - "github.com/hashicorp/go-argmapper" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" - - "github.com/hashicorp/waypoint/sdk/component" - "github.com/hashicorp/waypoint/sdk/component/mocks" - "github.com/hashicorp/waypoint/sdk/history" - historymocks "github.com/hashicorp/waypoint/sdk/history/mocks" - "github.com/hashicorp/waypoint/sdk/internal-shared/protomappers" - "github.com/hashicorp/waypoint/sdk/internal/testproto" - pb "github.com/hashicorp/waypoint/sdk/proto" -) - -func init() { - // Set our default log level lower for tests - hclog.L().SetLevel(hclog.Trace) -} - -func TestPlugins(t *testing.T) { - require := require.New(t) - - mock := &mocks.Builder{} - plugins := Plugins(WithComponents(mock)) - bp := plugins[1]["builder"].(*BuilderPlugin) - require.Equal(bp.Impl, mock) -} - -func testDefaultMappers(t *testing.T) []*argmapper.Func { - var mappers []*argmapper.Func - for _, raw := range protomappers.All { - f, err := argmapper.NewFunc(raw) - require.NoError(t, err) - mappers = append(mappers, f) - } - - return mappers -} - -// testDynamicFunc ensures that the dynamic function capabilities work -// properly. This should be called for each individual dynamic function -// the component exposes. -func testDynamicFunc( - t *testing.T, - typ string, - value interface{}, - setFunc func(interface{}, interface{}), // set the function on your mock - getFunc func(interface{}) interface{}, // get the function -) { - require := require.New(t) - assert := assert.New(t) - - // Our callback that we verify. We specify a LOT of args here because - // we want to verify that each one will work properly. This is the core - // of this test. - called := false - setFunc(value, func( - ctx context.Context, - args *component.Source, - historyClient history.Client, - ) *testproto.Data { - called = true - assert.NotNil(ctx) - assert.Equal("foo", args.App) - - // Test history client - assert.NotNil(historyClient) - _, err := historyClient.Deployments(ctx, nil) - assert.NoError(err) - - return &testproto.Data{Value: "hello"} - }) - - // Get the mappers - mappers := testDefaultMappers(t) - - // Init the plugin server - plugins := Plugins(WithComponents(value), WithMappers(mappers...)) - client, server := plugin.TestPluginGRPCConn(t, plugins[1]) - defer client.Close() - defer server.Stop() - - // Dispense the plugin - raw, err := client.Dispense(typ) - require.NoError(err) - implFunc := getFunc(raw).(*argmapper.Func) - - historyMock := &historymocks.Client{} - historyMock.On("Deployments", mock.Anything, &history.Lookup{}).Return([]component.Deployment{}, nil) - - // Call our function by building a chain. We use the chain so we - // have access to the same level of mappers that a default plugin - // would normally have. - result := implFunc.Call( - argmapper.ConverterFunc(mappers...), - - argmapper.Typed(context.Background()), - argmapper.Typed(hclog.L()), - - argmapper.Typed(&pb.Args_Source{App: "foo"}), - argmapper.Typed(historyMock), - ) - require.NoError(result.Err()) - - // We only require a result if the function type expects us to return - // a result. Otherwise, we just expect nil because it is error-only. - if result.Len() > 0 { - require.NotNil(result.Out(0)) - } - - require.True(called) -} diff --git a/sdk/internal/plugin/registry.go b/sdk/internal/plugin/registry.go deleted file mode 100644 index 0fd61248a47..00000000000 --- a/sdk/internal/plugin/registry.go +++ /dev/null @@ -1,214 +0,0 @@ -package plugin - -import ( - "context" - - "github.com/golang/protobuf/ptypes/empty" - "github.com/hashicorp/go-argmapper" - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/hashicorp/waypoint/sdk/component" - "github.com/hashicorp/waypoint/sdk/docs" - "github.com/hashicorp/waypoint/sdk/internal/funcspec" - "github.com/hashicorp/waypoint/sdk/internal/pluginargs" - "github.com/hashicorp/waypoint/sdk/internal/plugincomponent" - "github.com/hashicorp/waypoint/sdk/proto" -) - -// RegistryPlugin implements plugin.Plugin (specifically GRPCPlugin) for -// the Registry component type. -type RegistryPlugin struct { - plugin.NetRPCUnsupportedPlugin - - Impl component.Registry // Impl is the concrete implementation - Mappers []*argmapper.Func // Mappers - Logger hclog.Logger // Logger -} - -func (p *RegistryPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error { - base := &base{ - Mappers: p.Mappers, - Logger: p.Logger, - Broker: broker, - } - - proto.RegisterRegistryServer(s, ®istryServer{ - base: base, - Impl: p.Impl, - - authenticatorServer: &authenticatorServer{ - base: base, - Impl: p.Impl, - }, - }) - return nil -} - -func (p *RegistryPlugin) GRPCClient( - ctx context.Context, - broker *plugin.GRPCBroker, - c *grpc.ClientConn, -) (interface{}, error) { - client := ®istryClient{ - client: proto.NewRegistryClient(c), - logger: p.Logger, - broker: broker, - mappers: p.Mappers, - } - - authenticator := &authenticatorClient{ - Client: client.client, - Logger: client.logger, - Broker: client.broker, - Mappers: client.mappers, - } - if ok, err := authenticator.Implements(ctx); err != nil { - return nil, err - } else if ok { - p.Logger.Info("registry plugin capable of auth") - } else { - authenticator = nil - } - - result := &mix_Registry_Authenticator{ - ConfigurableNotify: client, - Registry: client, - Authenticator: authenticator, - Documented: client, - } - - return result, nil -} - -// registryClient is an implementation of component.Registry over gRPC. -type registryClient struct { - client proto.RegistryClient - logger hclog.Logger - broker *plugin.GRPCBroker - mappers []*argmapper.Func -} - -func (c *registryClient) Config() (interface{}, error) { - return configStructCall(context.Background(), c.client) -} - -func (c *registryClient) ConfigSet(v interface{}) error { - return configureCall(context.Background(), c.client, v) -} - -func (c *registryClient) Documentation() (*docs.Documentation, error) { - return documentationCall(context.Background(), c.client) -} - -func (c *registryClient) PushFunc() interface{} { - // Get the spec - spec, err := c.client.PushSpec(context.Background(), &proto.Empty{}) - if err != nil { - panic(err) - } - - // We don't want to be a mapper - spec.Result = nil - - return funcspec.Func(spec, c.push, - argmapper.Logger(c.logger), - argmapper.Typed(&pluginargs.Internal{ - Broker: c.broker, - Mappers: c.mappers, - Cleanup: &pluginargs.Cleanup{}, - }), - ) -} - -func (c *registryClient) push( - ctx context.Context, - args funcspec.Args, -) (component.Artifact, error) { - // Call our function - resp, err := c.client.Push(ctx, &proto.FuncSpec_Args{Args: args}) - if err != nil { - return nil, err - } - - // We return the *any.Any directly. - return &plugincomponent.Artifact{Any: resp.Result}, nil -} - -// registryServer is a gRPC server that the client talks to and calls a -// real implementation of the component. -type registryServer struct { - *base - *authenticatorServer - - Impl component.Registry -} - -func (s *registryServer) ConfigStruct( - ctx context.Context, - empty *empty.Empty, -) (*proto.Config_StructResp, error) { - return configStruct(s.Impl) -} - -func (s *registryServer) Configure( - ctx context.Context, - req *proto.Config_ConfigureRequest, -) (*empty.Empty, error) { - return configure(s.Impl, req) -} - -func (s *registryServer) Documentation( - ctx context.Context, - empty *empty.Empty, -) (*proto.Config_Documentation, error) { - return documentation(s.Impl) -} - -func (s *registryServer) PushSpec( - ctx context.Context, - args *proto.Empty, -) (*proto.FuncSpec, error) { - if s.Impl == nil { - return nil, status.Errorf(codes.Unimplemented, "plugin does not implement: registry") - } - - return funcspec.Spec(s.Impl.PushFunc(), - argmapper.ConverterFunc(s.Mappers...), - argmapper.Logger(s.Logger), - argmapper.Typed(s.internal()), - ) -} - -func (s *registryServer) Push( - ctx context.Context, - args *proto.FuncSpec_Args, -) (*proto.Push_Resp, error) { - internal := s.internal() - defer internal.Cleanup.Close() - - encoded, _, err := callDynamicFuncAny2(s.Impl.PushFunc(), args.Args, - argmapper.ConverterFunc(s.Mappers...), - argmapper.Logger(s.Logger), - argmapper.Typed(ctx), - argmapper.Typed(internal), - ) - if err != nil { - return nil, err - } - - return &proto.Push_Resp{Result: encoded}, nil -} - -var ( - _ plugin.Plugin = (*RegistryPlugin)(nil) - _ plugin.GRPCPlugin = (*RegistryPlugin)(nil) - _ proto.RegistryServer = (*registryServer)(nil) - _ component.Registry = (*registryClient)(nil) - _ component.Configurable = (*registryClient)(nil) - _ component.Documented = (*registryClient)(nil) - _ component.ConfigurableNotify = (*registryClient)(nil) -) diff --git a/sdk/internal/plugin/registry_mix.go b/sdk/internal/plugin/registry_mix.go deleted file mode 100644 index 63b2618991f..00000000000 --- a/sdk/internal/plugin/registry_mix.go +++ /dev/null @@ -1,12 +0,0 @@ -package plugin - -import ( - "github.com/hashicorp/waypoint/sdk/component" -) - -type mix_Registry_Authenticator struct { - component.Authenticator - component.ConfigurableNotify - component.Registry - component.Documented -} diff --git a/sdk/internal/plugin/registry_test.go b/sdk/internal/plugin/registry_test.go deleted file mode 100644 index 261dda0d537..00000000000 --- a/sdk/internal/plugin/registry_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package plugin - -import ( - "testing" - - "github.com/hashicorp/waypoint/sdk/component" - "github.com/hashicorp/waypoint/sdk/component/mocks" -) - -func TestRegistryDynamicFunc_validateAuth(t *testing.T) { - testDynamicFunc(t, "registry", &mockRegistryAuthenticator{}, func(v, f interface{}) { - v.(*mockRegistryAuthenticator).Authenticator.On("ValidateAuthFunc").Return(f) - }, func(raw interface{}) interface{} { - return raw.(component.Authenticator).ValidateAuthFunc() - }) -} -func TestRegistryDynamicFunc_auth(t *testing.T) { - testDynamicFunc(t, "registry", &mockRegistryAuthenticator{}, func(v, f interface{}) { - v.(*mockRegistryAuthenticator).Authenticator.On("AuthFunc").Return(f) - }, func(raw interface{}) interface{} { - return raw.(component.Authenticator).AuthFunc() - }) -} - -func TestRegistryConfig(t *testing.T) { - mockV := &mockRegistryConfigurable{} - testConfigurable(t, "registry", mockV, &mockV.Configurable) -} - -type mockRegistryAuthenticator struct { - mocks.Registry - mocks.Authenticator -} - -type mockRegistryConfigurable struct { - mocks.Registry - mocks.Configurable -} diff --git a/sdk/internal/plugin/releaser.go b/sdk/internal/plugin/releaser.go deleted file mode 100644 index dda2953c829..00000000000 --- a/sdk/internal/plugin/releaser.go +++ /dev/null @@ -1,276 +0,0 @@ -package plugin - -import ( - "context" - - "github.com/golang/protobuf/ptypes/empty" - "github.com/hashicorp/go-argmapper" - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - - "github.com/hashicorp/waypoint/sdk/component" - "github.com/hashicorp/waypoint/sdk/docs" - "github.com/hashicorp/waypoint/sdk/internal/funcspec" - "github.com/hashicorp/waypoint/sdk/internal/pluginargs" - "github.com/hashicorp/waypoint/sdk/internal/plugincomponent" - "github.com/hashicorp/waypoint/sdk/proto" -) - -// ReleaseManagerPlugin implements plugin.Plugin (specifically GRPCPlugin) for -// the ReleaseManager component type. -type ReleaseManagerPlugin struct { - plugin.NetRPCUnsupportedPlugin - - Impl component.ReleaseManager // Impl is the concrete implementation - Mappers []*argmapper.Func // Mappers - Logger hclog.Logger // Logger -} - -func (p *ReleaseManagerPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error { - base := &base{ - Mappers: p.Mappers, - Logger: p.Logger, - Broker: broker, - } - - proto.RegisterReleaseManagerServer(s, &releaseManagerServer{ - base: base, - Impl: p.Impl, - - authenticatorServer: &authenticatorServer{ - base: base, - Impl: p.Impl, - }, - - destroyerServer: &destroyerServer{ - base: base, - Impl: p.Impl, - }, - - workspaceDestroyerServer: &workspaceDestroyerServer{ - base: base, - Impl: p.Impl, - }, - }) - return nil -} - -func (p *ReleaseManagerPlugin) GRPCClient( - ctx context.Context, - broker *plugin.GRPCBroker, - c *grpc.ClientConn, -) (interface{}, error) { - client := &releaseManagerClient{ - client: proto.NewReleaseManagerClient(c), - logger: p.Logger, - broker: broker, - mappers: p.Mappers, - } - - authenticator := &authenticatorClient{ - Client: client.client, - Logger: client.logger, - Broker: client.broker, - Mappers: client.mappers, - } - if ok, err := authenticator.Implements(ctx); err != nil { - return nil, err - } else if ok { - p.Logger.Info("release plugin capable of auth") - } else { - authenticator = nil - } - - // Compose destroyer - destroyer := &destroyerClient{ - Client: client.client, - Logger: client.logger, - Broker: client.broker, - Mappers: client.mappers, - } - if ok, err := destroyer.Implements(ctx); err != nil { - return nil, err - } else if ok { - p.Logger.Info("release plugin capable of destroy") - } else { - destroyer = nil - } - - // Compose workspace destroyer - wsDestroyer := &workspaceDestroyerClient{ - Client: client.client, - Logger: client.logger, - Broker: client.broker, - Mappers: client.mappers, - } - if ok, err := wsDestroyer.Implements(ctx); err != nil { - return nil, err - } else if ok { - p.Logger.Info("platform plugin capable of destroy") - } else { - wsDestroyer = nil - } - - result := &mix_ReleaseManager_Authenticator{ - ConfigurableNotify: client, - ReleaseManager: client, - Authenticator: authenticator, - Destroyer: destroyer, - WorkspaceDestroyer: wsDestroyer, - Documented: client, - } - - return result, nil -} - -// releaseManagerClient is an implementation of component.ReleaseManager that -// communicates over gRPC. -type releaseManagerClient struct { - client proto.ReleaseManagerClient - logger hclog.Logger - broker *plugin.GRPCBroker - mappers []*argmapper.Func -} - -func (c *releaseManagerClient) Config() (interface{}, error) { - return configStructCall(context.Background(), c.client) -} - -func (c *releaseManagerClient) ConfigSet(v interface{}) error { - return configureCall(context.Background(), c.client, v) -} - -func (c *releaseManagerClient) Documentation() (*docs.Documentation, error) { - return documentationCall(context.Background(), c.client) -} - -func (c *releaseManagerClient) ReleaseFunc() interface{} { - if c == nil || c.client == nil { - return nil - } - - // Get the build spec - spec, err := c.client.ReleaseSpec(context.Background(), &proto.Empty{}) - if err != nil { - return funcErr(err) - } - - // We don't want to be a mapper - spec.Result = nil - - return funcspec.Func(spec, c.build, - argmapper.Logger(c.logger), - argmapper.Typed(&pluginargs.Internal{ - Broker: c.broker, - Mappers: c.mappers, - Cleanup: &pluginargs.Cleanup{}, - }), - ) -} - -func (c *releaseManagerClient) build( - ctx context.Context, - args funcspec.Args, -) (component.Release, error) { - // Call our function - resp, err := c.client.Release(ctx, &proto.FuncSpec_Args{Args: args}) - if err != nil { - return nil, err - } - - // We return the - return &plugincomponent.Release{ - Any: resp.Result, - Release: resp.Release, - }, nil -} - -// releaseManagerServer is a gRPC server that the client talks to and calls a -// real implementation of the component. -type releaseManagerServer struct { - *base - *authenticatorServer - *destroyerServer - *workspaceDestroyerServer - - Impl component.ReleaseManager -} - -func (s *releaseManagerServer) ConfigStruct( - ctx context.Context, - empty *empty.Empty, -) (*proto.Config_StructResp, error) { - return configStruct(s.Impl) -} - -func (s *releaseManagerServer) Documentation( - ctx context.Context, - empty *empty.Empty, -) (*proto.Config_Documentation, error) { - return documentation(s.Impl) -} - -func (s *releaseManagerServer) Configure( - ctx context.Context, - req *proto.Config_ConfigureRequest, -) (*empty.Empty, error) { - return configure(s.Impl, req) -} - -func (s *releaseManagerServer) ReleaseSpec( - ctx context.Context, - args *proto.Empty, -) (*proto.FuncSpec, error) { - if s.Impl == nil { - return nil, status.Errorf(codes.Unimplemented, "plugin does not implement: release manager") - } - - return funcspec.Spec(s.Impl.ReleaseFunc(), - argmapper.ConverterFunc(s.Mappers...), - argmapper.Logger(s.Logger), - argmapper.Typed(s.internal()), - ) -} - -func (s *releaseManagerServer) Release( - ctx context.Context, - args *proto.FuncSpec_Args, -) (*proto.Release_Resp, error) { - internal := s.internal() - defer internal.Cleanup.Close() - - raw, err := callDynamicFunc2(s.Impl.ReleaseFunc(), args.Args, - argmapper.ConverterFunc(s.Mappers...), - argmapper.Logger(s.Logger), - argmapper.Typed(ctx), - argmapper.Typed(internal), - ) - if err != nil { - return nil, err - } - encoded, err := component.ProtoAny(raw) - if err != nil { - return nil, err - } - - release := raw.(component.Release) - return &proto.Release_Resp{ - Result: encoded, - Release: &proto.Release{ - Url: release.URL(), - }, - }, nil -} - -var ( - _ plugin.Plugin = (*ReleaseManagerPlugin)(nil) - _ plugin.GRPCPlugin = (*ReleaseManagerPlugin)(nil) - _ proto.ReleaseManagerServer = (*releaseManagerServer)(nil) - _ component.ReleaseManager = (*releaseManagerClient)(nil) - _ component.Configurable = (*releaseManagerClient)(nil) - _ component.Documented = (*releaseManagerClient)(nil) - _ component.ConfigurableNotify = (*releaseManagerClient)(nil) -) diff --git a/sdk/internal/plugin/releaser_mix.go b/sdk/internal/plugin/releaser_mix.go deleted file mode 100644 index dfe2d489036..00000000000 --- a/sdk/internal/plugin/releaser_mix.go +++ /dev/null @@ -1,14 +0,0 @@ -package plugin - -import ( - "github.com/hashicorp/waypoint/sdk/component" -) - -type mix_ReleaseManager_Authenticator struct { - component.Authenticator - component.ConfigurableNotify - component.ReleaseManager - component.Destroyer - component.WorkspaceDestroyer - component.Documented -} diff --git a/sdk/internal/plugin/releaser_test.go b/sdk/internal/plugin/releaser_test.go deleted file mode 100644 index 4d40e31ec1a..00000000000 --- a/sdk/internal/plugin/releaser_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package plugin - -import ( - "testing" - - "github.com/hashicorp/waypoint/sdk/component" - "github.com/hashicorp/waypoint/sdk/component/mocks" -) - -func TestReleaseManagerDynamicFunc_validateAuth(t *testing.T) { - testDynamicFunc(t, "releasemanager", &mockReleaseManagerAuthenticator{}, func(v, f interface{}) { - v.(*mockReleaseManagerAuthenticator).Authenticator.On("ValidateAuthFunc").Return(f) - }, func(raw interface{}) interface{} { - return raw.(component.Authenticator).ValidateAuthFunc() - }) -} -func TestReleaseManagerDynamicFunc_auth(t *testing.T) { - testDynamicFunc(t, "releasemanager", &mockReleaseManagerAuthenticator{}, func(v, f interface{}) { - v.(*mockReleaseManagerAuthenticator).Authenticator.On("AuthFunc").Return(f) - }, func(raw interface{}) interface{} { - return raw.(component.Authenticator).AuthFunc() - }) -} - -func TestReleaseManagerDynamicFunc_destroy(t *testing.T) { - testDynamicFunc(t, "releasemanager", &mockReleaseManagerDestroyer{}, func(v, f interface{}) { - v.(*mockReleaseManagerDestroyer).Destroyer.On("DestroyFunc").Return(f) - }, func(raw interface{}) interface{} { - return raw.(component.Destroyer).DestroyFunc() - }) -} - -func TestReleaseManagerConfig(t *testing.T) { - mockV := &mockReleaseManagerConfigurable{} - testConfigurable(t, "releasemanager", mockV, &mockV.Configurable) -} - -type mockReleaseManagerAuthenticator struct { - mocks.ReleaseManager - mocks.Authenticator -} - -type mockReleaseManagerConfigurable struct { - mocks.ReleaseManager - mocks.Configurable -} - -type mockReleaseManagerDestroyer struct { - mocks.ReleaseManager - mocks.Destroyer -} diff --git a/sdk/internal/plugin/terminal/ui.go b/sdk/internal/plugin/terminal/ui.go deleted file mode 100644 index 410da52b8d8..00000000000 --- a/sdk/internal/plugin/terminal/ui.go +++ /dev/null @@ -1,779 +0,0 @@ -package terminal - -import ( - "context" - "fmt" - "io" - "os" - "sync" - - "github.com/creack/pty" - "github.com/golang/protobuf/ptypes/empty" - "github.com/hashicorp/go-argmapper" - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" - spb "google.golang.org/genproto/googleapis/rpc/status" - "google.golang.org/grpc" - statuspkg "google.golang.org/grpc/status" - - pb "github.com/hashicorp/waypoint/sdk/proto" - "github.com/hashicorp/waypoint/sdk/terminal" -) - -// UIPlugin implements plugin.Plugin (specifically GRPCPlugin) for -// the terminal.UI interface. -type UIPlugin struct { - plugin.NetRPCUnsupportedPlugin - - Impl terminal.UI // Impl is the concrete implementation - Mappers []*argmapper.Func // Mappers - Logger hclog.Logger // Logger -} - -func (p *UIPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error { - pb.RegisterTerminalUIServiceServer(s, &uiServer{ - Impl: p.Impl, - Mappers: p.Mappers, - Logger: p.Logger, - }) - return nil -} - -func (p *UIPlugin) GRPCClient( - ctx context.Context, - broker *plugin.GRPCBroker, - c *grpc.ClientConn, -) (interface{}, error) { - client := pb.NewTerminalUIServiceClient(c) - resp, err := client.IsInteractive(ctx, &empty.Empty{}) - if err != nil { - return nil, err - } - - evstream, err := client.Events(ctx) - if err != nil { - return nil, err - } - - ctx, cancel := context.WithCancel(ctx) - - return &uiBridge{ - ctx: ctx, - cancel: cancel, - interactive: resp.Interactive, - evc: evstream, - }, nil -} - -// uiServer is a gRPC server that the client talks to and calls a -// real implementation of the component. -type uiServer struct { - Impl terminal.UI - Mappers []*argmapper.Func - Logger hclog.Logger -} - -func (s *uiServer) Output( - ctx context.Context, - req *pb.TerminalUI_OutputRequest, -) (*empty.Empty, error) { - for _, line := range req.Lines { - s.Impl.Output(line) - } - - return &empty.Empty{}, nil -} - -func (s *uiServer) IsInteractive( - ctx context.Context, - req *empty.Empty, -) (*pb.TerminalUI_IsInteractiveResponse, error) { - return &pb.TerminalUI_IsInteractiveResponse{ - Interactive: s.Impl.Interactive(), - }, nil -} - -func (s *uiServer) Events(stream pb.TerminalUIService_EventsServer) error { - type stepData struct { - terminal.Step - out io.Writer - } - - var ( - status terminal.Status - stdout io.Writer - stderr io.Writer - - sg terminal.StepGroup - steps = map[int32]*stepData{} - ) - - for { - ev, err := stream.Recv() - if err != nil { - if err == io.EOF { - return nil - } - - return err - } - - switch ev := ev.Event.(type) { - case *pb.TerminalUI_Event_Line_: - s.Impl.Output(ev.Line.Msg, terminal.WithStyle(ev.Line.Style)) - case *pb.TerminalUI_Event_NamedValues_: - var values []terminal.NamedValue - - for _, nv := range ev.NamedValues.Values { - values = append(values, terminal.NamedValue{ - Name: nv.Name, - Value: nv.Value, - }) - } - - s.Impl.NamedValues(values) - case *pb.TerminalUI_Event_Status_: - if ev.Status.Msg == "" && !ev.Status.Step { - if status != nil { - status.Close() - } - } else { - if status == nil { - status = s.Impl.Status() - defer status.Close() - } - - if ev.Status.Step { - status.Step(ev.Status.Status, ev.Status.Msg) - } else { - status.Update(ev.Status.Msg) - } - } - case *pb.TerminalUI_Event_Raw_: - if stdout == nil { - stdout, stderr, err = s.Impl.OutputWriters() - if err != nil { - return err - } - } - - if ev.Raw.Stderr { - stderr.Write(ev.Raw.Data) - } else { - stdout.Write(ev.Raw.Data) - } - case *pb.TerminalUI_Event_Table_: - tbl := terminal.NewTable(ev.Table.Headers...) - - for _, row := range ev.Table.Rows { - var trow []terminal.TableEntry - - for _, ent := range row.Entries { - trow = append(trow, terminal.TableEntry{ - Value: ent.Value, - Color: ent.Color, - }) - } - } - - s.Impl.Table(tbl) - case *pb.TerminalUI_Event_StepGroup_: - if sg != nil { - sg.Wait() - } - - if !ev.StepGroup.Close { - sg = s.Impl.StepGroup() - } - case *pb.TerminalUI_Event_Step_: - if sg == nil { - continue - } - - step, ok := steps[ev.Step.Id] - if !ok { - step = &stepData{ - Step: sg.Add(ev.Step.Msg), - } - steps[ev.Step.Id] = step - } else { - if ev.Step.Msg != "" { - step.Update(ev.Step.Msg) - } - } - - if ev.Step.Status != "" { - if ev.Step.Status == terminal.StatusAbort { - step.Abort() - } else { - step.Status(ev.Step.Status) - } - } - - if len(ev.Step.Output) > 0 { - if step.out == nil { - step.out = step.TermOutput() - } - - step.out.Write(ev.Step.Output) - } - - if ev.Step.Close { - step.Done() - } - case *pb.TerminalUI_Event_Input_: - result, err := s.Impl.Input(&terminal.Input{ - Prompt: ev.Input.Prompt, - Style: ev.Input.Style, - Secret: ev.Input.Secret, - }) - - var sterr *spb.Status - if err != nil { - st, _ := statuspkg.FromError(err) - sterr = st.Proto() - } - - respEvent := &pb.TerminalUI_Response{ - Event: &pb.TerminalUI_Response_Input{ - Input: &pb.TerminalUI_Event_InputResp{ - Input: result, - Error: sterr, - }, - }, - } - if err := stream.Send(respEvent); err != nil { - return err - } - default: - s.Logger.Error("Unknown terminal event seen", "type", hclog.Fmt("%T", ev)) - } - } -} - -type uiBridge struct { - ctx context.Context - cancel func() - mu sync.Mutex - evc pb.TerminalUIService_EventsClient - interactive bool - - evcRecvLock sync.Mutex - stdSetup sync.Once - stdout, stderr io.Writer -} - -func (u *uiBridge) Close() error { - u.mu.Lock() - defer u.mu.Unlock() - - err := u.evc.CloseSend() - u.evc = nil - u.cancel() - - return err -} - -func (u *uiBridge) Input(input *terminal.Input) (string, error) { - if !u.interactive { - return "", terminal.ErrNonInteractive - } - - u.evcRecvLock.Lock() - defer u.evcRecvLock.Unlock() - - err := u.evc.Send(&pb.TerminalUI_Event{ - Event: &pb.TerminalUI_Event_Input_{ - Input: &pb.TerminalUI_Event_Input{ - Prompt: input.Prompt, - Style: input.Style, - Secret: input.Secret, - }, - }, - }) - if err != nil { - return "", err - } - - // Wait for the response - resp, err := u.evc.Recv() - if err != nil { - return "", err - } - - respEvent, ok := resp.Event.(*pb.TerminalUI_Response_Input) - if !ok { - return "", fmt.Errorf("unexpected response type: %T", resp.Event) - } - - if respEvent.Input.Error != nil { - return "", statuspkg.FromProto(respEvent.Input.Error).Err() - } - - return respEvent.Input.Input, nil -} - -func (u *uiBridge) Interactive() bool { - return u.interactive -} - -// Output outputs a message directly to the terminal. The remaining -// arguments should be interpolations for the format string. After the -// interpolations you may add Options. -func (u *uiBridge) Output(msg string, raw ...interface{}) { - msg, style, _ := terminal.Interpret(msg, raw...) - - ev := &pb.TerminalUI_Event{ - Event: &pb.TerminalUI_Event_Line_{ - Line: &pb.TerminalUI_Event_Line{ - Msg: msg, - Style: style, - }, - }, - } - - u.mu.Lock() - defer u.mu.Unlock() - - if u.evc == nil { - return - } - - u.evc.Send(ev) -} - -// Output data as a table of data. Each entry is a row which will be output -// with the columns lined up nicely. -func (u *uiBridge) NamedValues(tvalues []terminal.NamedValue, _ ...terminal.Option) { - var values []*pb.TerminalUI_Event_NamedValue - - for _, nv := range tvalues { - values = append(values, &pb.TerminalUI_Event_NamedValue{ - Name: nv.Name, - Value: fmt.Sprintf("%s", nv.Value), - }) - } - - u.mu.Lock() - defer u.mu.Unlock() - - if u.evc == nil { - return - } - - u.evc.Send(&pb.TerminalUI_Event{ - Event: &pb.TerminalUI_Event_NamedValues_{ - NamedValues: &pb.TerminalUI_Event_NamedValues{ - Values: values, - }, - }, - }) -} - -// OutputWriters returns stdout and stderr writers. These are usually -// but not always TTYs. This is useful for subprocesses, network requests, -// etc. Note that writing to these is not thread-safe by default so -// you must take care that there is only ever one writer. -func (u *uiBridge) OutputWriters() (stdout io.Writer, stderr io.Writer, err error) { - u.stdSetup.Do(func() { - dr, dw, err := pty.Open() - if err != nil { - panic(err) - } - - err = pty.Setsize(dw, &pty.Winsize{ - Rows: uint16(terminal.TermRows), - Cols: uint16(terminal.TermColumns), - }) - - if err != nil { - panic(err) - } - - go u.sendData(dr, false) - - er, ew, err := os.Pipe() - if err != nil { - panic(err) - } - - go u.sendData(er, true) - - go func() { - <-u.ctx.Done() - dr.Close() - dw.Close() - er.Close() - ew.Close() - }() - - u.stdout = dw - u.stderr = ew - }) - - return u.stdout, u.stderr, nil -} - -func (u *uiBridge) sendData(r io.ReadCloser, stderr bool) { - defer r.Close() - - buf := make([]byte, 1024) - - for { - n, err := r.Read(buf) - if err != nil { - return - } - - data := buf[:n] - - ev := &pb.TerminalUI_Event{ - Event: &pb.TerminalUI_Event_Raw_{ - Raw: &pb.TerminalUI_Event_Raw{ - Data: data, - Stderr: stderr, - }, - }, - } - - u.mu.Lock() - if u.evc == nil { - u.mu.Unlock() - return - } - - u.evc.Send(ev) - u.mu.Unlock() - } -} - -func (u *uiBridge) Table(tbl *terminal.Table, opts ...terminal.Option) { - var ( - ptbl *pb.TerminalUI_Event_Table - rows []*pb.TerminalUI_Event_TableRow - ) - - ptbl.Headers = tbl.Headers - - for _, row := range tbl.Rows { - var entries []*pb.TerminalUI_Event_TableEntry - - for _, ent := range row { - entries = append(entries, &pb.TerminalUI_Event_TableEntry{ - Value: ent.Value, - Color: ent.Color, - }) - } - - rows = append(rows, &pb.TerminalUI_Event_TableRow{ - Entries: entries, - }) - } - - u.mu.Lock() - defer u.mu.Unlock() - - if u.evc == nil { - return - } - - u.evc.Send(&pb.TerminalUI_Event{ - Event: &pb.TerminalUI_Event_Table_{ - Table: ptbl, - }, - }) -} - -type uiBridgeSGStep struct { - sg *uiBridgeSG - id int32 - done bool - - stdSetup sync.Once - stdout io.Writer -} - -func (u *uiBridgeSGStep) TermOutput() io.Writer { - u.stdSetup.Do(func() { - dr, dw, err := pty.Open() - if err != nil { - panic(err) - } - - go u.sendData(dr, false) - - go func() { - <-u.sg.ctx.Done() - dr.Close() - dw.Close() - }() - - u.stdout = dw - }) - - return u.stdout -} - -func (u *uiBridgeSGStep) sendData(r io.ReadCloser, stderr bool) { - defer r.Close() - - buf := make([]byte, 1024) - - for { - n, err := r.Read(buf) - if err != nil { - return - } - - data := buf[:n] - - ev := &pb.TerminalUI_Event{ - Event: &pb.TerminalUI_Event_Step_{ - Step: &pb.TerminalUI_Event_Step{ - Id: u.id, - Output: data, - }, - }, - } - - u.sg.ui.mu.Lock() - if u.sg.ui.evc == nil { - u.sg.ui.mu.Unlock() - return - } - - u.sg.ui.evc.Send(ev) - u.sg.ui.mu.Unlock() - } -} - -func (u *uiBridgeSGStep) Update(str string, args ...interface{}) { - msg := fmt.Sprintf(str, args...) - - u.sg.ui.mu.Lock() - defer u.sg.ui.mu.Unlock() - - if u.sg.ui.evc != nil { - u.sg.ui.evc.Send(&pb.TerminalUI_Event{ - Event: &pb.TerminalUI_Event_Step_{ - Step: &pb.TerminalUI_Event_Step{ - Id: u.id, - Msg: msg, - }, - }, - }) - } -} - -func (u *uiBridgeSGStep) Status(status string) { - u.sg.ui.mu.Lock() - defer u.sg.ui.mu.Unlock() - - if u.sg.ui.evc != nil { - u.sg.ui.evc.Send(&pb.TerminalUI_Event{ - Event: &pb.TerminalUI_Event_Step_{ - Step: &pb.TerminalUI_Event_Step{ - Id: u.id, - Status: status, - }, - }, - }) - } -} - -func (u *uiBridgeSGStep) Done() { - u.sg.ui.mu.Lock() - defer u.sg.ui.mu.Unlock() - - if u.done { - return - } - - u.done = true - - if u.sg.ui.evc != nil { - u.sg.ui.evc.Send(&pb.TerminalUI_Event{ - Event: &pb.TerminalUI_Event_Step_{ - Step: &pb.TerminalUI_Event_Step{ - Id: u.id, - Close: true, - }, - }, - }) - } - - u.sg.wg.Done() -} - -func (u *uiBridgeSGStep) Abort() { - u.sg.ui.mu.Lock() - defer u.sg.ui.mu.Unlock() - - if u.done { - return - } - - u.done = true - - if u.sg.ui.evc != nil { - u.sg.ui.evc.Send(&pb.TerminalUI_Event{ - Event: &pb.TerminalUI_Event_Step_{ - Step: &pb.TerminalUI_Event_Step{ - Id: u.id, - Close: true, - Status: terminal.StatusAbort, - }, - }, - }) - } - - u.sg.wg.Done() -} - -type uiBridgeSG struct { - ctx context.Context - cancel func() - - ui *uiBridge - wg sync.WaitGroup - - steps []*uiBridgeSGStep -} - -// Start a step in the output -func (u *uiBridgeSG) Add(str string, args ...interface{}) terminal.Step { - msg := fmt.Sprintf(str, args...) - - u.ui.mu.Lock() - defer u.ui.mu.Unlock() - - u.wg.Add(1) - - step := &uiBridgeSGStep{ - sg: u, - id: int32(len(u.steps)), - } - - u.steps = append(u.steps, step) - - u.ui.evc.Send(&pb.TerminalUI_Event{ - Event: &pb.TerminalUI_Event_Step_{ - Step: &pb.TerminalUI_Event_Step{ - Id: step.id, - Msg: msg, - }, - }, - }) - - return step -} - -func (u *uiBridgeSG) Wait() { - u.wg.Wait() - u.cancel() - - u.ui.evc.Send(&pb.TerminalUI_Event{ - Event: &pb.TerminalUI_Event_StepGroup_{ - StepGroup: &pb.TerminalUI_Event_StepGroup{ - Close: true, - }, - }, - }) - -} - -func (u *uiBridge) StepGroup() terminal.StepGroup { - ctx, cancel := context.WithCancel(u.ctx) - - sg := &uiBridgeSG{ - ui: u, - ctx: ctx, - cancel: cancel, - } - - u.evc.Send(&pb.TerminalUI_Event{ - Event: &pb.TerminalUI_Event_StepGroup_{ - StepGroup: &pb.TerminalUI_Event_StepGroup{}, - }, - }) - - return sg -} - -// Status returns a live-updating status that can be used for single-line -// status updates that typically have a spinner or some similar style. -func (u *uiBridge) Status() terminal.Status { - return &uiBridgeStatus{u} -} - -type uiBridgeStatus struct { - b *uiBridge -} - -// Update writes a new status. This should be a single line. -func (u *uiBridgeStatus) Update(msg string) { - u.b.mu.Lock() - defer u.b.mu.Unlock() - - if u.b.evc == nil { - return - } - - u.b.evc.Send(&pb.TerminalUI_Event{ - Event: &pb.TerminalUI_Event_Status_{ - Status: &pb.TerminalUI_Event_Status{ - Msg: msg, - }, - }, - }) -} - -// Indicate that a step has finished, confering an ok, error, or warn upon -// it's finishing state. If the status is not StatusOK, StatusError, or StatusWarn -// then the status text is written directly to the output, allowing for custom -// statuses. -func (u *uiBridgeStatus) Step(status string, msg string) { - u.b.mu.Lock() - defer u.b.mu.Unlock() - - if u.b.evc == nil { - return - } - - u.b.evc.Send(&pb.TerminalUI_Event{ - Event: &pb.TerminalUI_Event_Status_{ - Status: &pb.TerminalUI_Event_Status{ - Status: status, - Msg: msg, - Step: true, - }, - }, - }) -} - -// Close should be called when the live updating is complete. The -// status will be cleared from the line. -func (u *uiBridgeStatus) Close() error { - u.b.mu.Lock() - defer u.b.mu.Unlock() - - if u.b.evc == nil { - return nil - } - - u.b.evc.Send(&pb.TerminalUI_Event{ - Event: &pb.TerminalUI_Event_Status_{ - Status: &pb.TerminalUI_Event_Status{}, - }, - }) - - return nil -} - -var ( - _ plugin.Plugin = (*UIPlugin)(nil) - _ plugin.GRPCPlugin = (*UIPlugin)(nil) - _ pb.TerminalUIServiceServer = (*uiServer)(nil) - _ terminal.UI = (*uiBridge)(nil) - _ terminal.Status = (*uiBridgeStatus)(nil) -) diff --git a/sdk/internal/pluginargs/pluginargs.go b/sdk/internal/pluginargs/pluginargs.go deleted file mode 100644 index 38c7e14eb00..00000000000 --- a/sdk/internal/pluginargs/pluginargs.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package pluginargs -package pluginargs - -import ( - "github.com/hashicorp/go-plugin" - "github.com/hashicorp/go-argmapper" -) - -// Internal is a struct that is available to mappers. This is an internal-only -// type that is not possible for plugins to register for since it is only -// exported in an internal package. -type Internal struct { - Broker *plugin.GRPCBroker - Mappers []*argmapper.Func - Cleanup *Cleanup -} - -// Cleanup can be used to register cleanup functions. -type Cleanup struct { - f func() -} - -// Do registers a cleanup function that will be called when the plugin RPC -// call is complete. -func (c *Cleanup) Do(f func()) { - oldF := c.f - c.f = func() { - if oldF != nil { - defer oldF() - } - f() - } -} - -func (c *Cleanup) Close() error { - if c.f != nil { - c.f() - } - - return nil -} diff --git a/sdk/internal/plugincomponent/artifact.go b/sdk/internal/plugincomponent/artifact.go deleted file mode 100644 index 0dafa5eb828..00000000000 --- a/sdk/internal/plugincomponent/artifact.go +++ /dev/null @@ -1,22 +0,0 @@ -package plugincomponent - -import ( - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes/any" - - "github.com/hashicorp/waypoint/sdk/component" -) - -// Artifact implements component.Artifact. -type Artifact struct { - Any *any.Any - LabelsVal map[string]string -} - -func (c *Artifact) Proto() proto.Message { return c.Any } - -func (c *Artifact) Labels() map[string]string { return c.LabelsVal } - -var ( - _ component.Artifact = (*Artifact)(nil) -) diff --git a/sdk/internal/plugincomponent/deployment.go b/sdk/internal/plugincomponent/deployment.go deleted file mode 100644 index 22cd57d9321..00000000000 --- a/sdk/internal/plugincomponent/deployment.go +++ /dev/null @@ -1,18 +0,0 @@ -package plugincomponent - -import ( - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes/any" - - "github.com/hashicorp/waypoint/sdk/component" -) - -// Deployment implements component.Deployment. -type Deployment struct { - Any *any.Any -} - -func (c *Deployment) Proto() proto.Message { return c.Any } -func (c *Deployment) String() string { return "" } - -var _ component.Deployment = (*Deployment)(nil) diff --git a/sdk/internal/plugincomponent/doc.go b/sdk/internal/plugincomponent/doc.go deleted file mode 100644 index 9f93aaa5048..00000000000 --- a/sdk/internal/plugincomponent/doc.go +++ /dev/null @@ -1,3 +0,0 @@ -// Package plugincomponent has helpers to convert or expose component -// implementations for plugin proto structures. -package plugincomponent diff --git a/sdk/internal/plugincomponent/release.go b/sdk/internal/plugincomponent/release.go deleted file mode 100644 index 75f2177301d..00000000000 --- a/sdk/internal/plugincomponent/release.go +++ /dev/null @@ -1,20 +0,0 @@ -package plugincomponent - -import ( - "github.com/golang/protobuf/proto" - "github.com/golang/protobuf/ptypes/any" - - "github.com/hashicorp/waypoint/sdk/component" - pb "github.com/hashicorp/waypoint/sdk/proto" -) - -// Release implements component.Release. -type Release struct { - Any *any.Any - Release *pb.Release -} - -func (c *Release) Proto() proto.Message { return c.Any } -func (c *Release) URL() string { return c.Release.Url } - -var _ component.Release = (*Release)(nil) diff --git a/sdk/internal/stdio/stdio.go b/sdk/internal/stdio/stdio.go deleted file mode 100644 index 03869049c49..00000000000 --- a/sdk/internal/stdio/stdio.go +++ /dev/null @@ -1,35 +0,0 @@ -package stdio - -import ( - "os" - "sync" -) - -// NOTE(mitchellh): this won't work on Windows. We need to do something like -// this: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea?redirectedfrom=MSDN - -// We cache the stdout/stderr files because we need to use the same *os.File -// or we'll get a hang. -var ( - once sync.Once - stdout, stderr *os.File -) - -// Stdout returns the stdout file that was passed as an extra file descriptor -// to the plugin. We do this so that we can get access to a real TTY if -// possible for subprocess output. -func Stdout() *os.File { - once.Do(initFds) - return stdout -} - -// Stderr. See stdout for details. -func Stderr() *os.File { - once.Do(initFds) - return stderr -} - -func initFds() { - stdout = os.NewFile(uintptr(3), "stdout") - stderr = os.NewFile(uintptr(3), "stdout") -} diff --git a/sdk/internal/testproto/testproto.go b/sdk/internal/testproto/testproto.go deleted file mode 100644 index cc9d72303ac..00000000000 --- a/sdk/internal/testproto/testproto.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package testproto contains some protobuf defintions that are used -// in internal tests. -package testproto - -//go:generate sh -c "protoc -I ./ ./*.proto --go_out=plugins=grpc:./" diff --git a/sdk/internal/testproto/testproto.pb.go b/sdk/internal/testproto/testproto.pb.go deleted file mode 100644 index 4ec5c21c36b..00000000000 --- a/sdk/internal/testproto/testproto.pb.go +++ /dev/null @@ -1,282 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v3.11.2 -// source: testproto.proto - -package testproto - -import ( - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Data is just some data, used for tests so meant to be meaningless. -type Data struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` - Number int32 `protobuf:"varint,2,opt,name=number,proto3" json:"number,omitempty"` -} - -func (x *Data) Reset() { - *x = Data{} - if protoimpl.UnsafeEnabled { - mi := &file_testproto_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Data) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Data) ProtoMessage() {} - -func (x *Data) ProtoReflect() protoreflect.Message { - mi := &file_testproto_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Data.ProtoReflect.Descriptor instead. -func (*Data) Descriptor() ([]byte, []int) { - return file_testproto_proto_rawDescGZIP(), []int{0} -} - -func (x *Data) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -func (x *Data) GetNumber() int32 { - if x != nil { - return x.Number - } - return 0 -} - -// Other types that we can use. There isn't any purpose for this other -// than to provide message types that can be used for tests. -type A struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value int32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *A) Reset() { - *x = A{} - if protoimpl.UnsafeEnabled { - mi := &file_testproto_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *A) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*A) ProtoMessage() {} - -func (x *A) ProtoReflect() protoreflect.Message { - mi := &file_testproto_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use A.ProtoReflect.Descriptor instead. -func (*A) Descriptor() ([]byte, []int) { - return file_testproto_proto_rawDescGZIP(), []int{1} -} - -func (x *A) GetValue() int32 { - if x != nil { - return x.Value - } - return 0 -} - -type B struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value int32 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *B) Reset() { - *x = B{} - if protoimpl.UnsafeEnabled { - mi := &file_testproto_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *B) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*B) ProtoMessage() {} - -func (x *B) ProtoReflect() protoreflect.Message { - mi := &file_testproto_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use B.ProtoReflect.Descriptor instead. -func (*B) Descriptor() ([]byte, []int) { - return file_testproto_proto_rawDescGZIP(), []int{2} -} - -func (x *B) GetValue() int32 { - if x != nil { - return x.Value - } - return 0 -} - -var File_testproto_proto protoreflect.FileDescriptor - -var file_testproto_proto_rawDesc = []byte{ - 0x0a, 0x0f, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x09, 0x74, 0x65, 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x34, 0x0a, 0x04, - 0x44, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x22, 0x19, 0x0a, 0x01, 0x41, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x19, 0x0a, - 0x01, 0x42, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0d, 0x5a, 0x0b, 0x2e, 0x3b, 0x74, 0x65, - 0x73, 0x74, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_testproto_proto_rawDescOnce sync.Once - file_testproto_proto_rawDescData = file_testproto_proto_rawDesc -) - -func file_testproto_proto_rawDescGZIP() []byte { - file_testproto_proto_rawDescOnce.Do(func() { - file_testproto_proto_rawDescData = protoimpl.X.CompressGZIP(file_testproto_proto_rawDescData) - }) - return file_testproto_proto_rawDescData -} - -var file_testproto_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_testproto_proto_goTypes = []interface{}{ - (*Data)(nil), // 0: testproto.Data - (*A)(nil), // 1: testproto.A - (*B)(nil), // 2: testproto.B -} -var file_testproto_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_testproto_proto_init() } -func file_testproto_proto_init() { - if File_testproto_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_testproto_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Data); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testproto_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*A); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_testproto_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*B); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_testproto_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_testproto_proto_goTypes, - DependencyIndexes: file_testproto_proto_depIdxs, - MessageInfos: file_testproto_proto_msgTypes, - }.Build() - File_testproto_proto = out.File - file_testproto_proto_rawDesc = nil - file_testproto_proto_goTypes = nil - file_testproto_proto_depIdxs = nil -} diff --git a/sdk/internal/testproto/testproto.proto b/sdk/internal/testproto/testproto.proto deleted file mode 100644 index 7207d682759..00000000000 --- a/sdk/internal/testproto/testproto.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; - -package testproto; -option go_package = '.;testproto'; - -// Data is just some data, used for tests so meant to be meaningless. -message Data { - string value = 1; - int32 number = 2; -} - -// Other types that we can use. There isn't any purpose for this other -// than to provide message types that can be used for tests. -message A { int32 value = 1; } -message B { int32 value = 2; } diff --git a/sdk/main.go b/sdk/main.go deleted file mode 100644 index 56fd6542730..00000000000 --- a/sdk/main.go +++ /dev/null @@ -1,125 +0,0 @@ -package sdk - -import ( - "os" - - "github.com/fatih/color" - "github.com/hashicorp/go-argmapper" - "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin" - "github.com/mattn/go-colorable" - - "github.com/hashicorp/waypoint/sdk/internal-shared/protomappers" - sdkplugin "github.com/hashicorp/waypoint/sdk/internal/plugin" - "github.com/hashicorp/waypoint/sdk/internal/stdio" -) - -//go:generate sh -c "protoc -I`go list -m -f \"{{.Dir}}\" github.com/mitchellh/protostructure` -I ../vendor/proto/api-common-protos -I proto/ proto/*.proto --go_out=plugins=grpc:proto/" - -// Main is the primary entrypoint for plugins serving components. This -// function never returns; it blocks until the program is exited. This should -// be called immediately in main() in your plugin binaries, no prior setup -// should be done. -func Main(opts ...Option) { - - var c config - - // Default our mappers - c.Mappers = append(c.Mappers, protomappers.All...) - - // Build config - for _, opt := range opts { - opt(&c) - } - - // We have to rewrite the fatih/color package output/error writers - // to be our plugin stdout/stderr. We use the color package a lot in - // our UI and this causes the UI to work. - color.Output = colorable.NewColorable(stdio.Stdout()) - color.Error = colorable.NewColorable(stdio.Stderr()) - - // Create our logger. We also set this as the default logger in case - // any other libraries are using hclog and our plugin doesn't properly - // chain it along. - log := hclog.New(&hclog.LoggerOptions{ - Name: "plugin", - Level: hclog.Trace, - Output: os.Stderr, - Color: hclog.AutoColor, - - // Critical that this is JSON-formatted. Since we're a plugin this - // will enable the host to parse our logs and output them in a - // structured way. - JSONFormat: true, - }) - hclog.SetDefault(log) - - // Build up our mappers - var mappers []*argmapper.Func - for _, raw := range c.Mappers { - // If the mapper is already a argmapper.Func, then we let that through as-is - m, ok := raw.(*argmapper.Func) - if !ok { - var err error - m, err = argmapper.NewFunc(raw, argmapper.Logger(log)) - if err != nil { - panic(err) - } - } - - mappers = append(mappers, m) - } - - // Serve - plugin.Serve(&plugin.ServeConfig{ - HandshakeConfig: sdkplugin.Handshake, - VersionedPlugins: sdkplugin.Plugins( - sdkplugin.WithComponents(c.Components...), - sdkplugin.WithMappers(mappers...), - sdkplugin.WithLogger(log), - ), - GRPCServer: plugin.DefaultGRPCServer, - Logger: log, - }) -} - -// config is the configuration for Main. This can only be modified using -// Option implementations. -type config struct { - // Components is the list of components to serve from the plugin. - Components []interface{} - - // Mappers is the list of mapper functions. - Mappers []interface{} -} - -// Option modifies config. Zero or more can be passed to Main. -type Option func(*config) - -// WithComponents specifies a list of components to serve from the plugin -// binary. This will append to the list of components to serve. You can -// currently only serve at most one of each type of plugin. -func WithComponents(cs ...interface{}) Option { - return func(c *config) { c.Components = append(c.Components, cs...) } -} - -// WithMappers specifies a list of mappers to apply to the plugin. -// -// Mappers are functions that take zero or more arguments and return -// one result (optionally with an error). These can be used to convert argument -// types as needed for your plugin functions. For example, you can convert a -// proto type to a richer Go struct. -// -// Mappers must take zero or more arguments and return exactly one or two -// values where the second return type must be an error. Example: -// -// func() *Value -// func() (*Value, error) -// -- the above with any arguments -// -// This will append the mappers to the list of available mappers. A set of -// default mappers is always included to convert from SDK proto types to -// richer Go structs. -func WithMappers(ms ...interface{}) Option { - return func(c *config) { c.Mappers = append(c.Mappers, ms...) } -} diff --git a/sdk/proto/builder.pb.go b/sdk/proto/builder.pb.go deleted file mode 100644 index b63888569ea..00000000000 --- a/sdk/proto/builder.pb.go +++ /dev/null @@ -1,701 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v3.11.2 -// source: builder.proto - -package proto - -import ( - context "context" - proto "github.com/golang/protobuf/proto" - any "github.com/golang/protobuf/ptypes/any" - empty "github.com/golang/protobuf/ptypes/empty" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type Build struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *Build) Reset() { - *x = Build{} - if protoimpl.UnsafeEnabled { - mi := &file_builder_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Build) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Build) ProtoMessage() {} - -func (x *Build) ProtoReflect() protoreflect.Message { - mi := &file_builder_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Build.ProtoReflect.Descriptor instead. -func (*Build) Descriptor() ([]byte, []int) { - return file_builder_proto_rawDescGZIP(), []int{0} -} - -type Build_Resp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Result *any.Any `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` - Labels map[string]string `protobuf:"bytes,2,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *Build_Resp) Reset() { - *x = Build_Resp{} - if protoimpl.UnsafeEnabled { - mi := &file_builder_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Build_Resp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Build_Resp) ProtoMessage() {} - -func (x *Build_Resp) ProtoReflect() protoreflect.Message { - mi := &file_builder_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Build_Resp.ProtoReflect.Descriptor instead. -func (*Build_Resp) Descriptor() ([]byte, []int) { - return file_builder_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *Build_Resp) GetResult() *any.Any { - if x != nil { - return x.Result - } - return nil -} - -func (x *Build_Resp) GetLabels() map[string]string { - if x != nil { - return x.Labels - } - return nil -} - -var File_builder_proto protoreflect.FileDescriptor - -var file_builder_proto_rawDesc = []byte{ - 0x0a, 0x0d, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, - 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb0, 0x01, 0x0a, - 0x05, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x1a, 0xa6, 0x01, 0x0a, 0x04, 0x52, 0x65, 0x73, 0x70, 0x12, - 0x2c, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x35, 0x0a, - 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x52, 0x65, 0x73, 0x70, - 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, - 0x62, 0x65, 0x6c, 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x32, - 0xde, 0x04, 0x0a, 0x07, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x12, 0x40, 0x0a, 0x0f, 0x49, - 0x73, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, - 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x36, 0x0a, - 0x04, 0x41, 0x75, 0x74, 0x68, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, - 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x18, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x41, 0x75, 0x74, 0x68, 0x53, 0x70, 0x65, - 0x63, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x12, 0x3c, 0x0a, 0x0c, 0x56, 0x61, - 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x41, 0x72, 0x67, 0x73, - 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x3b, 0x0a, 0x10, 0x56, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x53, 0x70, 0x65, 0x63, 0x12, 0x16, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, - 0x63, 0x53, 0x70, 0x65, 0x63, 0x12, 0x40, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, - 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x18, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x53, 0x74, 0x72, - 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x43, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x75, 0x72, 0x65, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x44, 0x0a, 0x0d, - 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x2a, 0x0a, 0x09, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x53, 0x70, 0x65, 0x63, 0x12, - 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x12, 0x30, - 0x0a, 0x05, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x11, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x52, 0x65, 0x73, 0x70, - 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_builder_proto_rawDescOnce sync.Once - file_builder_proto_rawDescData = file_builder_proto_rawDesc -) - -func file_builder_proto_rawDescGZIP() []byte { - file_builder_proto_rawDescOnce.Do(func() { - file_builder_proto_rawDescData = protoimpl.X.CompressGZIP(file_builder_proto_rawDescData) - }) - return file_builder_proto_rawDescData -} - -var file_builder_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_builder_proto_goTypes = []interface{}{ - (*Build)(nil), // 0: proto.Build - (*Build_Resp)(nil), // 1: proto.Build.Resp - nil, // 2: proto.Build.Resp.LabelsEntry - (*any.Any)(nil), // 3: google.protobuf.Any - (*empty.Empty)(nil), // 4: google.protobuf.Empty - (*FuncSpec_Args)(nil), // 5: proto.FuncSpec.Args - (*Config_ConfigureRequest)(nil), // 6: proto.Config.ConfigureRequest - (*Empty)(nil), // 7: proto.Empty - (*ImplementsResp)(nil), // 8: proto.ImplementsResp - (*Auth_AuthResponse)(nil), // 9: proto.Auth.AuthResponse - (*FuncSpec)(nil), // 10: proto.FuncSpec - (*Config_StructResp)(nil), // 11: proto.Config.StructResp - (*Config_Documentation)(nil), // 12: proto.Config.Documentation -} -var file_builder_proto_depIdxs = []int32{ - 3, // 0: proto.Build.Resp.result:type_name -> google.protobuf.Any - 2, // 1: proto.Build.Resp.labels:type_name -> proto.Build.Resp.LabelsEntry - 4, // 2: proto.Builder.IsAuthenticator:input_type -> google.protobuf.Empty - 5, // 3: proto.Builder.Auth:input_type -> proto.FuncSpec.Args - 4, // 4: proto.Builder.AuthSpec:input_type -> google.protobuf.Empty - 5, // 5: proto.Builder.ValidateAuth:input_type -> proto.FuncSpec.Args - 4, // 6: proto.Builder.ValidateAuthSpec:input_type -> google.protobuf.Empty - 4, // 7: proto.Builder.ConfigStruct:input_type -> google.protobuf.Empty - 6, // 8: proto.Builder.Configure:input_type -> proto.Config.ConfigureRequest - 4, // 9: proto.Builder.Documentation:input_type -> google.protobuf.Empty - 7, // 10: proto.Builder.BuildSpec:input_type -> proto.Empty - 5, // 11: proto.Builder.Build:input_type -> proto.FuncSpec.Args - 8, // 12: proto.Builder.IsAuthenticator:output_type -> proto.ImplementsResp - 9, // 13: proto.Builder.Auth:output_type -> proto.Auth.AuthResponse - 10, // 14: proto.Builder.AuthSpec:output_type -> proto.FuncSpec - 4, // 15: proto.Builder.ValidateAuth:output_type -> google.protobuf.Empty - 10, // 16: proto.Builder.ValidateAuthSpec:output_type -> proto.FuncSpec - 11, // 17: proto.Builder.ConfigStruct:output_type -> proto.Config.StructResp - 4, // 18: proto.Builder.Configure:output_type -> google.protobuf.Empty - 12, // 19: proto.Builder.Documentation:output_type -> proto.Config.Documentation - 10, // 20: proto.Builder.BuildSpec:output_type -> proto.FuncSpec - 1, // 21: proto.Builder.Build:output_type -> proto.Build.Resp - 12, // [12:22] is the sub-list for method output_type - 2, // [2:12] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_builder_proto_init() } -func file_builder_proto_init() { - if File_builder_proto != nil { - return - } - file_plugin_proto_init() - if !protoimpl.UnsafeEnabled { - file_builder_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Build); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_builder_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Build_Resp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_builder_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_builder_proto_goTypes, - DependencyIndexes: file_builder_proto_depIdxs, - MessageInfos: file_builder_proto_msgTypes, - }.Build() - File_builder_proto = out.File - file_builder_proto_rawDesc = nil - file_builder_proto_goTypes = nil - file_builder_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// BuilderClient is the client API for Builder service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type BuilderClient interface { - IsAuthenticator(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImplementsResp, error) - Auth(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*Auth_AuthResponse, error) - AuthSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) - ValidateAuth(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*empty.Empty, error) - ValidateAuthSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) - ConfigStruct(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Config_StructResp, error) - Configure(ctx context.Context, in *Config_ConfigureRequest, opts ...grpc.CallOption) (*empty.Empty, error) - Documentation(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Config_Documentation, error) - BuildSpec(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*FuncSpec, error) - Build(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*Build_Resp, error) -} - -type builderClient struct { - cc grpc.ClientConnInterface -} - -func NewBuilderClient(cc grpc.ClientConnInterface) BuilderClient { - return &builderClient{cc} -} - -func (c *builderClient) IsAuthenticator(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImplementsResp, error) { - out := new(ImplementsResp) - err := c.cc.Invoke(ctx, "/proto.Builder/IsAuthenticator", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *builderClient) Auth(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*Auth_AuthResponse, error) { - out := new(Auth_AuthResponse) - err := c.cc.Invoke(ctx, "/proto.Builder/Auth", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *builderClient) AuthSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) { - out := new(FuncSpec) - err := c.cc.Invoke(ctx, "/proto.Builder/AuthSpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *builderClient) ValidateAuth(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/proto.Builder/ValidateAuth", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *builderClient) ValidateAuthSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) { - out := new(FuncSpec) - err := c.cc.Invoke(ctx, "/proto.Builder/ValidateAuthSpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *builderClient) ConfigStruct(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Config_StructResp, error) { - out := new(Config_StructResp) - err := c.cc.Invoke(ctx, "/proto.Builder/ConfigStruct", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *builderClient) Configure(ctx context.Context, in *Config_ConfigureRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/proto.Builder/Configure", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *builderClient) Documentation(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Config_Documentation, error) { - out := new(Config_Documentation) - err := c.cc.Invoke(ctx, "/proto.Builder/Documentation", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *builderClient) BuildSpec(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*FuncSpec, error) { - out := new(FuncSpec) - err := c.cc.Invoke(ctx, "/proto.Builder/BuildSpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *builderClient) Build(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*Build_Resp, error) { - out := new(Build_Resp) - err := c.cc.Invoke(ctx, "/proto.Builder/Build", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// BuilderServer is the server API for Builder service. -type BuilderServer interface { - IsAuthenticator(context.Context, *empty.Empty) (*ImplementsResp, error) - Auth(context.Context, *FuncSpec_Args) (*Auth_AuthResponse, error) - AuthSpec(context.Context, *empty.Empty) (*FuncSpec, error) - ValidateAuth(context.Context, *FuncSpec_Args) (*empty.Empty, error) - ValidateAuthSpec(context.Context, *empty.Empty) (*FuncSpec, error) - ConfigStruct(context.Context, *empty.Empty) (*Config_StructResp, error) - Configure(context.Context, *Config_ConfigureRequest) (*empty.Empty, error) - Documentation(context.Context, *empty.Empty) (*Config_Documentation, error) - BuildSpec(context.Context, *Empty) (*FuncSpec, error) - Build(context.Context, *FuncSpec_Args) (*Build_Resp, error) -} - -// UnimplementedBuilderServer can be embedded to have forward compatible implementations. -type UnimplementedBuilderServer struct { -} - -func (*UnimplementedBuilderServer) IsAuthenticator(context.Context, *empty.Empty) (*ImplementsResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method IsAuthenticator not implemented") -} -func (*UnimplementedBuilderServer) Auth(context.Context, *FuncSpec_Args) (*Auth_AuthResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Auth not implemented") -} -func (*UnimplementedBuilderServer) AuthSpec(context.Context, *empty.Empty) (*FuncSpec, error) { - return nil, status.Errorf(codes.Unimplemented, "method AuthSpec not implemented") -} -func (*UnimplementedBuilderServer) ValidateAuth(context.Context, *FuncSpec_Args) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateAuth not implemented") -} -func (*UnimplementedBuilderServer) ValidateAuthSpec(context.Context, *empty.Empty) (*FuncSpec, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateAuthSpec not implemented") -} -func (*UnimplementedBuilderServer) ConfigStruct(context.Context, *empty.Empty) (*Config_StructResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method ConfigStruct not implemented") -} -func (*UnimplementedBuilderServer) Configure(context.Context, *Config_ConfigureRequest) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method Configure not implemented") -} -func (*UnimplementedBuilderServer) Documentation(context.Context, *empty.Empty) (*Config_Documentation, error) { - return nil, status.Errorf(codes.Unimplemented, "method Documentation not implemented") -} -func (*UnimplementedBuilderServer) BuildSpec(context.Context, *Empty) (*FuncSpec, error) { - return nil, status.Errorf(codes.Unimplemented, "method BuildSpec not implemented") -} -func (*UnimplementedBuilderServer) Build(context.Context, *FuncSpec_Args) (*Build_Resp, error) { - return nil, status.Errorf(codes.Unimplemented, "method Build not implemented") -} - -func RegisterBuilderServer(s *grpc.Server, srv BuilderServer) { - s.RegisterService(&_Builder_serviceDesc, srv) -} - -func _Builder_IsAuthenticator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BuilderServer).IsAuthenticator(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Builder/IsAuthenticator", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BuilderServer).IsAuthenticator(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Builder_Auth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FuncSpec_Args) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BuilderServer).Auth(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Builder/Auth", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BuilderServer).Auth(ctx, req.(*FuncSpec_Args)) - } - return interceptor(ctx, in, info, handler) -} - -func _Builder_AuthSpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BuilderServer).AuthSpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Builder/AuthSpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BuilderServer).AuthSpec(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Builder_ValidateAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FuncSpec_Args) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BuilderServer).ValidateAuth(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Builder/ValidateAuth", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BuilderServer).ValidateAuth(ctx, req.(*FuncSpec_Args)) - } - return interceptor(ctx, in, info, handler) -} - -func _Builder_ValidateAuthSpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BuilderServer).ValidateAuthSpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Builder/ValidateAuthSpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BuilderServer).ValidateAuthSpec(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Builder_ConfigStruct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BuilderServer).ConfigStruct(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Builder/ConfigStruct", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BuilderServer).ConfigStruct(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Builder_Configure_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Config_ConfigureRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BuilderServer).Configure(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Builder/Configure", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BuilderServer).Configure(ctx, req.(*Config_ConfigureRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Builder_Documentation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BuilderServer).Documentation(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Builder/Documentation", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BuilderServer).Documentation(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Builder_BuildSpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BuilderServer).BuildSpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Builder/BuildSpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BuilderServer).BuildSpec(ctx, req.(*Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Builder_Build_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FuncSpec_Args) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(BuilderServer).Build(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Builder/Build", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BuilderServer).Build(ctx, req.(*FuncSpec_Args)) - } - return interceptor(ctx, in, info, handler) -} - -var _Builder_serviceDesc = grpc.ServiceDesc{ - ServiceName: "proto.Builder", - HandlerType: (*BuilderServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "IsAuthenticator", - Handler: _Builder_IsAuthenticator_Handler, - }, - { - MethodName: "Auth", - Handler: _Builder_Auth_Handler, - }, - { - MethodName: "AuthSpec", - Handler: _Builder_AuthSpec_Handler, - }, - { - MethodName: "ValidateAuth", - Handler: _Builder_ValidateAuth_Handler, - }, - { - MethodName: "ValidateAuthSpec", - Handler: _Builder_ValidateAuthSpec_Handler, - }, - { - MethodName: "ConfigStruct", - Handler: _Builder_ConfigStruct_Handler, - }, - { - MethodName: "Configure", - Handler: _Builder_Configure_Handler, - }, - { - MethodName: "Documentation", - Handler: _Builder_Documentation_Handler, - }, - { - MethodName: "BuildSpec", - Handler: _Builder_BuildSpec_Handler, - }, - { - MethodName: "Build", - Handler: _Builder_Build_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "builder.proto", -} diff --git a/sdk/proto/builder.proto b/sdk/proto/builder.proto deleted file mode 100644 index ad95ccca703..00000000000 --- a/sdk/proto/builder.proto +++ /dev/null @@ -1,33 +0,0 @@ -syntax = "proto3"; - -package proto; - -option go_package = ".;proto"; - -import "google/protobuf/any.proto"; -import "google/protobuf/empty.proto"; -import "plugin.proto"; - -// Builder service is a builder that takes some set of arguments and produces -// an artifact. -service Builder { - rpc IsAuthenticator(google.protobuf.Empty) returns (ImplementsResp); - rpc Auth(FuncSpec.Args) returns (Auth.AuthResponse); - rpc AuthSpec(google.protobuf.Empty) returns (FuncSpec); - rpc ValidateAuth(FuncSpec.Args) returns (google.protobuf.Empty); - rpc ValidateAuthSpec(google.protobuf.Empty) returns (FuncSpec); - - rpc ConfigStruct(google.protobuf.Empty) returns (Config.StructResp); - rpc Configure(Config.ConfigureRequest) returns (google.protobuf.Empty); - rpc Documentation(google.protobuf.Empty) returns (Config.Documentation); - - rpc BuildSpec(Empty) returns (FuncSpec); - rpc Build(FuncSpec.Args) returns (Build.Resp); -} - -message Build { - message Resp { - google.protobuf.Any result = 1; - map labels = 2; - } -} diff --git a/sdk/proto/history.pb.go b/sdk/proto/history.pb.go deleted file mode 100644 index 8b473fc87a6..00000000000 --- a/sdk/proto/history.pb.go +++ /dev/null @@ -1,428 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v3.11.2 -// source: history.proto - -package proto - -import ( - context "context" - proto "github.com/golang/protobuf/proto" - any "github.com/golang/protobuf/ptypes/any" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type History_LookupRequest_FilterStatus int32 - -const ( - History_LookupRequest_INVALID History_LookupRequest_FilterStatus = 0 - History_LookupRequest_SUCCESS History_LookupRequest_FilterStatus = 1 - History_LookupRequest_ERROR History_LookupRequest_FilterStatus = 2 -) - -// Enum value maps for History_LookupRequest_FilterStatus. -var ( - History_LookupRequest_FilterStatus_name = map[int32]string{ - 0: "INVALID", - 1: "SUCCESS", - 2: "ERROR", - } - History_LookupRequest_FilterStatus_value = map[string]int32{ - "INVALID": 0, - "SUCCESS": 1, - "ERROR": 2, - } -) - -func (x History_LookupRequest_FilterStatus) Enum() *History_LookupRequest_FilterStatus { - p := new(History_LookupRequest_FilterStatus) - *p = x - return p -} - -func (x History_LookupRequest_FilterStatus) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (History_LookupRequest_FilterStatus) Descriptor() protoreflect.EnumDescriptor { - return file_history_proto_enumTypes[0].Descriptor() -} - -func (History_LookupRequest_FilterStatus) Type() protoreflect.EnumType { - return &file_history_proto_enumTypes[0] -} - -func (x History_LookupRequest_FilterStatus) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use History_LookupRequest_FilterStatus.Descriptor instead. -func (History_LookupRequest_FilterStatus) EnumDescriptor() ([]byte, []int) { - return file_history_proto_rawDescGZIP(), []int{0, 0, 0} -} - -type History struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *History) Reset() { - *x = History{} - if protoimpl.UnsafeEnabled { - mi := &file_history_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *History) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*History) ProtoMessage() {} - -func (x *History) ProtoReflect() protoreflect.Message { - mi := &file_history_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use History.ProtoReflect.Descriptor instead. -func (*History) Descriptor() ([]byte, []int) { - return file_history_proto_rawDescGZIP(), []int{0} -} - -type History_LookupRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Limit int32 `protobuf:"varint,1,opt,name=limit,proto3" json:"limit,omitempty"` - FilterStatus History_LookupRequest_FilterStatus `protobuf:"varint,2,opt,name=filter_status,json=filterStatus,proto3,enum=proto.History_LookupRequest_FilterStatus" json:"filter_status,omitempty"` -} - -func (x *History_LookupRequest) Reset() { - *x = History_LookupRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_history_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *History_LookupRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*History_LookupRequest) ProtoMessage() {} - -func (x *History_LookupRequest) ProtoReflect() protoreflect.Message { - mi := &file_history_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use History_LookupRequest.ProtoReflect.Descriptor instead. -func (*History_LookupRequest) Descriptor() ([]byte, []int) { - return file_history_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *History_LookupRequest) GetLimit() int32 { - if x != nil { - return x.Limit - } - return 0 -} - -func (x *History_LookupRequest) GetFilterStatus() History_LookupRequest_FilterStatus { - if x != nil { - return x.FilterStatus - } - return History_LookupRequest_INVALID -} - -type History_LookupResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Results []*any.Any `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` -} - -func (x *History_LookupResponse) Reset() { - *x = History_LookupResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_history_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *History_LookupResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*History_LookupResponse) ProtoMessage() {} - -func (x *History_LookupResponse) ProtoReflect() protoreflect.Message { - mi := &file_history_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use History_LookupResponse.ProtoReflect.Descriptor instead. -func (*History_LookupResponse) Descriptor() ([]byte, []int) { - return file_history_proto_rawDescGZIP(), []int{0, 1} -} - -func (x *History_LookupResponse) GetResults() []*any.Any { - if x != nil { - return x.Results - } - return nil -} - -var File_history_proto protoreflect.FileDescriptor - -var file_history_proto_rawDesc = []byte{ - 0x0a, 0x0d, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0xf8, 0x01, 0x0a, 0x07, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x1a, 0xaa, 0x01, - 0x0a, 0x0d, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, - 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x4e, 0x0a, 0x0d, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x5f, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x4c, 0x6f, 0x6f, - 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, - 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0c, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x33, 0x0a, 0x0c, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, - 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x01, 0x12, - 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x1a, 0x40, 0x0a, 0x0e, 0x4c, 0x6f, - 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x07, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x41, 0x6e, 0x79, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x32, 0x5c, 0x0a, 0x0e, - 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4a, - 0x0a, 0x0b, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x1c, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x4c, 0x6f, - 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, - 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_history_proto_rawDescOnce sync.Once - file_history_proto_rawDescData = file_history_proto_rawDesc -) - -func file_history_proto_rawDescGZIP() []byte { - file_history_proto_rawDescOnce.Do(func() { - file_history_proto_rawDescData = protoimpl.X.CompressGZIP(file_history_proto_rawDescData) - }) - return file_history_proto_rawDescData -} - -var file_history_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_history_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_history_proto_goTypes = []interface{}{ - (History_LookupRequest_FilterStatus)(0), // 0: proto.History.LookupRequest.FilterStatus - (*History)(nil), // 1: proto.History - (*History_LookupRequest)(nil), // 2: proto.History.LookupRequest - (*History_LookupResponse)(nil), // 3: proto.History.LookupResponse - (*any.Any)(nil), // 4: google.protobuf.Any -} -var file_history_proto_depIdxs = []int32{ - 0, // 0: proto.History.LookupRequest.filter_status:type_name -> proto.History.LookupRequest.FilterStatus - 4, // 1: proto.History.LookupResponse.results:type_name -> google.protobuf.Any - 2, // 2: proto.HistoryService.Deployments:input_type -> proto.History.LookupRequest - 3, // 3: proto.HistoryService.Deployments:output_type -> proto.History.LookupResponse - 3, // [3:4] is the sub-list for method output_type - 2, // [2:3] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_history_proto_init() } -func file_history_proto_init() { - if File_history_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_history_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*History); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_history_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*History_LookupRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_history_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*History_LookupResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_history_proto_rawDesc, - NumEnums: 1, - NumMessages: 3, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_history_proto_goTypes, - DependencyIndexes: file_history_proto_depIdxs, - EnumInfos: file_history_proto_enumTypes, - MessageInfos: file_history_proto_msgTypes, - }.Build() - File_history_proto = out.File - file_history_proto_rawDesc = nil - file_history_proto_goTypes = nil - file_history_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// HistoryServiceClient is the client API for HistoryService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type HistoryServiceClient interface { - Deployments(ctx context.Context, in *History_LookupRequest, opts ...grpc.CallOption) (*History_LookupResponse, error) -} - -type historyServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewHistoryServiceClient(cc grpc.ClientConnInterface) HistoryServiceClient { - return &historyServiceClient{cc} -} - -func (c *historyServiceClient) Deployments(ctx context.Context, in *History_LookupRequest, opts ...grpc.CallOption) (*History_LookupResponse, error) { - out := new(History_LookupResponse) - err := c.cc.Invoke(ctx, "/proto.HistoryService/Deployments", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// HistoryServiceServer is the server API for HistoryService service. -type HistoryServiceServer interface { - Deployments(context.Context, *History_LookupRequest) (*History_LookupResponse, error) -} - -// UnimplementedHistoryServiceServer can be embedded to have forward compatible implementations. -type UnimplementedHistoryServiceServer struct { -} - -func (*UnimplementedHistoryServiceServer) Deployments(context.Context, *History_LookupRequest) (*History_LookupResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Deployments not implemented") -} - -func RegisterHistoryServiceServer(s *grpc.Server, srv HistoryServiceServer) { - s.RegisterService(&_HistoryService_serviceDesc, srv) -} - -func _HistoryService_Deployments_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(History_LookupRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(HistoryServiceServer).Deployments(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.HistoryService/Deployments", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(HistoryServiceServer).Deployments(ctx, req.(*History_LookupRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _HistoryService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "proto.HistoryService", - HandlerType: (*HistoryServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Deployments", - Handler: _HistoryService_Deployments_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "history.proto", -} diff --git a/sdk/proto/history.proto b/sdk/proto/history.proto deleted file mode 100644 index d2051a464af..00000000000 --- a/sdk/proto/history.proto +++ /dev/null @@ -1,32 +0,0 @@ -syntax = "proto3"; - -package proto; - -option go_package = ".;proto"; - - -import "google/protobuf/any.proto"; - -// HistoryService service is service that provides the history functionality -// to plugins. Plugins don't interact with this directly, they usually -// interact with it indirectly via a history.Client interface object. -service HistoryService { - rpc Deployments(History.LookupRequest) returns (History.LookupResponse); -} - -message History { - message LookupRequest { - int32 limit = 1; - FilterStatus filter_status = 2; - - enum FilterStatus { - INVALID = 0; - SUCCESS = 1; - ERROR = 2; - } - } - - message LookupResponse { - repeated google.protobuf.Any results = 1; - } -} diff --git a/sdk/proto/logs.pb.go b/sdk/proto/logs.pb.go deleted file mode 100644 index da2d327bcaf..00000000000 --- a/sdk/proto/logs.pb.go +++ /dev/null @@ -1,571 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v3.11.2 -// source: logs.proto - -package proto - -import ( - context "context" - proto "github.com/golang/protobuf/proto" - empty "github.com/golang/protobuf/ptypes/empty" - timestamp "github.com/golang/protobuf/ptypes/timestamp" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type Logs struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *Logs) Reset() { - *x = Logs{} - if protoimpl.UnsafeEnabled { - mi := &file_logs_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Logs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Logs) ProtoMessage() {} - -func (x *Logs) ProtoReflect() protoreflect.Message { - mi := &file_logs_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Logs.ProtoReflect.Descriptor instead. -func (*Logs) Descriptor() ([]byte, []int) { - return file_logs_proto_rawDescGZIP(), []int{0} -} - -type Logs_Resp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // stream_id is the stream ID to connect to to get access to the - // LogViewer service. - StreamId uint32 `protobuf:"varint,1,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"` -} - -func (x *Logs_Resp) Reset() { - *x = Logs_Resp{} - if protoimpl.UnsafeEnabled { - mi := &file_logs_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Logs_Resp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Logs_Resp) ProtoMessage() {} - -func (x *Logs_Resp) ProtoReflect() protoreflect.Message { - mi := &file_logs_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Logs_Resp.ProtoReflect.Descriptor instead. -func (*Logs_Resp) Descriptor() ([]byte, []int) { - return file_logs_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *Logs_Resp) GetStreamId() uint32 { - if x != nil { - return x.StreamId - } - return 0 -} - -type Logs_NextBatchResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Events []*Logs_Event `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` -} - -func (x *Logs_NextBatchResp) Reset() { - *x = Logs_NextBatchResp{} - if protoimpl.UnsafeEnabled { - mi := &file_logs_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Logs_NextBatchResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Logs_NextBatchResp) ProtoMessage() {} - -func (x *Logs_NextBatchResp) ProtoReflect() protoreflect.Message { - mi := &file_logs_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Logs_NextBatchResp.ProtoReflect.Descriptor instead. -func (*Logs_NextBatchResp) Descriptor() ([]byte, []int) { - return file_logs_proto_rawDescGZIP(), []int{0, 1} -} - -func (x *Logs_NextBatchResp) GetEvents() []*Logs_Event { - if x != nil { - return x.Events - } - return nil -} - -type Logs_Event struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Partition string `protobuf:"bytes,1,opt,name=partition,proto3" json:"partition,omitempty"` - Timestamp *timestamp.Timestamp `protobuf:"bytes,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Contents string `protobuf:"bytes,3,opt,name=contents,proto3" json:"contents,omitempty"` -} - -func (x *Logs_Event) Reset() { - *x = Logs_Event{} - if protoimpl.UnsafeEnabled { - mi := &file_logs_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Logs_Event) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Logs_Event) ProtoMessage() {} - -func (x *Logs_Event) ProtoReflect() protoreflect.Message { - mi := &file_logs_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Logs_Event.ProtoReflect.Descriptor instead. -func (*Logs_Event) Descriptor() ([]byte, []int) { - return file_logs_proto_rawDescGZIP(), []int{0, 2} -} - -func (x *Logs_Event) GetPartition() string { - if x != nil { - return x.Partition - } - return "" -} - -func (x *Logs_Event) GetTimestamp() *timestamp.Timestamp { - if x != nil { - return x.Timestamp - } - return nil -} - -func (x *Logs_Event) GetContents() string { - if x != nil { - return x.Contents - } - return "" -} - -var File_logs_proto protoreflect.FileDescriptor - -var file_logs_proto_rawDesc = []byte{ - 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x0c, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0xe4, 0x01, 0x0a, 0x04, 0x4c, 0x6f, 0x67, 0x73, 0x1a, 0x23, 0x0a, 0x04, 0x52, 0x65, 0x73, 0x70, - 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x08, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x1a, 0x3a, 0x0a, - 0x0d, 0x4e, 0x65, 0x78, 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x29, - 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x6f, 0x67, 0x73, 0x2e, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x1a, 0x7b, 0x0a, 0x05, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, - 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x32, 0x72, 0x0a, 0x0b, 0x4c, 0x6f, 0x67, 0x50, 0x6c, 0x61, - 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x33, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x73, 0x53, 0x70, 0x65, - 0x63, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x12, 0x2e, 0x0a, 0x04, 0x4c, 0x6f, - 0x67, 0x73, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, - 0x70, 0x65, 0x63, 0x2e, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x4c, 0x6f, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x32, 0x4e, 0x0a, 0x09, 0x4c, 0x6f, - 0x67, 0x56, 0x69, 0x65, 0x77, 0x65, 0x72, 0x12, 0x41, 0x0a, 0x0c, 0x4e, 0x65, 0x78, 0x74, 0x4c, - 0x6f, 0x67, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, - 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x6f, 0x67, 0x73, 0x2e, 0x4e, 0x65, 0x78, - 0x74, 0x42, 0x61, 0x74, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_logs_proto_rawDescOnce sync.Once - file_logs_proto_rawDescData = file_logs_proto_rawDesc -) - -func file_logs_proto_rawDescGZIP() []byte { - file_logs_proto_rawDescOnce.Do(func() { - file_logs_proto_rawDescData = protoimpl.X.CompressGZIP(file_logs_proto_rawDescData) - }) - return file_logs_proto_rawDescData -} - -var file_logs_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_logs_proto_goTypes = []interface{}{ - (*Logs)(nil), // 0: proto.Logs - (*Logs_Resp)(nil), // 1: proto.Logs.Resp - (*Logs_NextBatchResp)(nil), // 2: proto.Logs.NextBatchResp - (*Logs_Event)(nil), // 3: proto.Logs.Event - (*timestamp.Timestamp)(nil), // 4: google.protobuf.Timestamp - (*empty.Empty)(nil), // 5: google.protobuf.Empty - (*FuncSpec_Args)(nil), // 6: proto.FuncSpec.Args - (*FuncSpec)(nil), // 7: proto.FuncSpec -} -var file_logs_proto_depIdxs = []int32{ - 3, // 0: proto.Logs.NextBatchResp.events:type_name -> proto.Logs.Event - 4, // 1: proto.Logs.Event.timestamp:type_name -> google.protobuf.Timestamp - 5, // 2: proto.LogPlatform.LogsSpec:input_type -> google.protobuf.Empty - 6, // 3: proto.LogPlatform.Logs:input_type -> proto.FuncSpec.Args - 5, // 4: proto.LogViewer.NextLogBatch:input_type -> google.protobuf.Empty - 7, // 5: proto.LogPlatform.LogsSpec:output_type -> proto.FuncSpec - 1, // 6: proto.LogPlatform.Logs:output_type -> proto.Logs.Resp - 2, // 7: proto.LogViewer.NextLogBatch:output_type -> proto.Logs.NextBatchResp - 5, // [5:8] is the sub-list for method output_type - 2, // [2:5] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_logs_proto_init() } -func file_logs_proto_init() { - if File_logs_proto != nil { - return - } - file_plugin_proto_init() - if !protoimpl.UnsafeEnabled { - file_logs_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Logs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_logs_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Logs_Resp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_logs_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Logs_NextBatchResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_logs_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Logs_Event); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_logs_proto_rawDesc, - NumEnums: 0, - NumMessages: 4, - NumExtensions: 0, - NumServices: 2, - }, - GoTypes: file_logs_proto_goTypes, - DependencyIndexes: file_logs_proto_depIdxs, - MessageInfos: file_logs_proto_msgTypes, - }.Build() - File_logs_proto = out.File - file_logs_proto_rawDesc = nil - file_logs_proto_goTypes = nil - file_logs_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// LogPlatformClient is the client API for LogPlatform service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type LogPlatformClient interface { - LogsSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) - Logs(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*Logs_Resp, error) -} - -type logPlatformClient struct { - cc grpc.ClientConnInterface -} - -func NewLogPlatformClient(cc grpc.ClientConnInterface) LogPlatformClient { - return &logPlatformClient{cc} -} - -func (c *logPlatformClient) LogsSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) { - out := new(FuncSpec) - err := c.cc.Invoke(ctx, "/proto.LogPlatform/LogsSpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *logPlatformClient) Logs(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*Logs_Resp, error) { - out := new(Logs_Resp) - err := c.cc.Invoke(ctx, "/proto.LogPlatform/Logs", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// LogPlatformServer is the server API for LogPlatform service. -type LogPlatformServer interface { - LogsSpec(context.Context, *empty.Empty) (*FuncSpec, error) - Logs(context.Context, *FuncSpec_Args) (*Logs_Resp, error) -} - -// UnimplementedLogPlatformServer can be embedded to have forward compatible implementations. -type UnimplementedLogPlatformServer struct { -} - -func (*UnimplementedLogPlatformServer) LogsSpec(context.Context, *empty.Empty) (*FuncSpec, error) { - return nil, status.Errorf(codes.Unimplemented, "method LogsSpec not implemented") -} -func (*UnimplementedLogPlatformServer) Logs(context.Context, *FuncSpec_Args) (*Logs_Resp, error) { - return nil, status.Errorf(codes.Unimplemented, "method Logs not implemented") -} - -func RegisterLogPlatformServer(s *grpc.Server, srv LogPlatformServer) { - s.RegisterService(&_LogPlatform_serviceDesc, srv) -} - -func _LogPlatform_LogsSpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogPlatformServer).LogsSpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.LogPlatform/LogsSpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogPlatformServer).LogsSpec(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _LogPlatform_Logs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FuncSpec_Args) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogPlatformServer).Logs(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.LogPlatform/Logs", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogPlatformServer).Logs(ctx, req.(*FuncSpec_Args)) - } - return interceptor(ctx, in, info, handler) -} - -var _LogPlatform_serviceDesc = grpc.ServiceDesc{ - ServiceName: "proto.LogPlatform", - HandlerType: (*LogPlatformServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "LogsSpec", - Handler: _LogPlatform_LogsSpec_Handler, - }, - { - MethodName: "Logs", - Handler: _LogPlatform_Logs_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "logs.proto", -} - -// LogViewerClient is the client API for LogViewer service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type LogViewerClient interface { - NextLogBatch(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Logs_NextBatchResp, error) -} - -type logViewerClient struct { - cc grpc.ClientConnInterface -} - -func NewLogViewerClient(cc grpc.ClientConnInterface) LogViewerClient { - return &logViewerClient{cc} -} - -func (c *logViewerClient) NextLogBatch(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Logs_NextBatchResp, error) { - out := new(Logs_NextBatchResp) - err := c.cc.Invoke(ctx, "/proto.LogViewer/NextLogBatch", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// LogViewerServer is the server API for LogViewer service. -type LogViewerServer interface { - NextLogBatch(context.Context, *empty.Empty) (*Logs_NextBatchResp, error) -} - -// UnimplementedLogViewerServer can be embedded to have forward compatible implementations. -type UnimplementedLogViewerServer struct { -} - -func (*UnimplementedLogViewerServer) NextLogBatch(context.Context, *empty.Empty) (*Logs_NextBatchResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method NextLogBatch not implemented") -} - -func RegisterLogViewerServer(s *grpc.Server, srv LogViewerServer) { - s.RegisterService(&_LogViewer_serviceDesc, srv) -} - -func _LogViewer_NextLogBatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(LogViewerServer).NextLogBatch(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.LogViewer/NextLogBatch", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(LogViewerServer).NextLogBatch(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -var _LogViewer_serviceDesc = grpc.ServiceDesc{ - ServiceName: "proto.LogViewer", - HandlerType: (*LogViewerServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "NextLogBatch", - Handler: _LogViewer_NextLogBatch_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "logs.proto", -} diff --git a/sdk/proto/logs.proto b/sdk/proto/logs.proto deleted file mode 100644 index d5965100e2b..00000000000 --- a/sdk/proto/logs.proto +++ /dev/null @@ -1,39 +0,0 @@ -syntax = "proto3"; - -package proto; - -option go_package = ".;proto"; - -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; -import "plugin.proto"; - -// LogPlatform is responsible for reading logs for a deployment. -service LogPlatform { - rpc LogsSpec(google.protobuf.Empty) returns (FuncSpec); - rpc Logs(FuncSpec.Args) returns (Logs.Resp); -} - -// LogViewer returns batches of log lines for a single app deployed -// on a platform (though that app may itself have multiple instances). -service LogViewer { - rpc NextLogBatch(google.protobuf.Empty) returns (Logs.NextBatchResp); -} - -message Logs { - message Resp { - // stream_id is the stream ID to connect to to get access to the - // LogViewer service. - uint32 stream_id = 1; - } - - message NextBatchResp { - repeated Event events = 1; - } - - message Event { - string partition = 1; - google.protobuf.Timestamp timestamp = 2; - string contents = 3; - } -} diff --git a/sdk/proto/mapper.pb.go b/sdk/proto/mapper.pb.go deleted file mode 100644 index bbbcc8563f1..00000000000 --- a/sdk/proto/mapper.pb.go +++ /dev/null @@ -1,490 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v3.11.2 -// source: mapper.proto - -package proto - -import ( - context "context" - proto "github.com/golang/protobuf/proto" - any "github.com/golang/protobuf/ptypes/any" - empty "github.com/golang/protobuf/ptypes/empty" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type Map struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *Map) Reset() { - *x = Map{} - if protoimpl.UnsafeEnabled { - mi := &file_mapper_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Map) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Map) ProtoMessage() {} - -func (x *Map) ProtoReflect() protoreflect.Message { - mi := &file_mapper_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Map.ProtoReflect.Descriptor instead. -func (*Map) Descriptor() ([]byte, []int) { - return file_mapper_proto_rawDescGZIP(), []int{0} -} - -type Map_Request struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // args is the list of argument types. - Args *FuncSpec_Args `protobuf:"bytes,1,opt,name=args,proto3" json:"args,omitempty"` - // result is the desired result type. - Result string `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"` -} - -func (x *Map_Request) Reset() { - *x = Map_Request{} - if protoimpl.UnsafeEnabled { - mi := &file_mapper_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Map_Request) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Map_Request) ProtoMessage() {} - -func (x *Map_Request) ProtoReflect() protoreflect.Message { - mi := &file_mapper_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Map_Request.ProtoReflect.Descriptor instead. -func (*Map_Request) Descriptor() ([]byte, []int) { - return file_mapper_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *Map_Request) GetArgs() *FuncSpec_Args { - if x != nil { - return x.Args - } - return nil -} - -func (x *Map_Request) GetResult() string { - if x != nil { - return x.Result - } - return "" -} - -type Map_Response struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // result is the mapped data type that matches the type expected - // by the MapRequest.result field. - Result *any.Any `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` -} - -func (x *Map_Response) Reset() { - *x = Map_Response{} - if protoimpl.UnsafeEnabled { - mi := &file_mapper_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Map_Response) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Map_Response) ProtoMessage() {} - -func (x *Map_Response) ProtoReflect() protoreflect.Message { - mi := &file_mapper_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Map_Response.ProtoReflect.Descriptor instead. -func (*Map_Response) Descriptor() ([]byte, []int) { - return file_mapper_proto_rawDescGZIP(), []int{0, 1} -} - -func (x *Map_Response) GetResult() *any.Any { - if x != nil { - return x.Result - } - return nil -} - -type Map_ListResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // FuncSpec - Funcs []*FuncSpec `protobuf:"bytes,1,rep,name=funcs,proto3" json:"funcs,omitempty"` -} - -func (x *Map_ListResponse) Reset() { - *x = Map_ListResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_mapper_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Map_ListResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Map_ListResponse) ProtoMessage() {} - -func (x *Map_ListResponse) ProtoReflect() protoreflect.Message { - mi := &file_mapper_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Map_ListResponse.ProtoReflect.Descriptor instead. -func (*Map_ListResponse) Descriptor() ([]byte, []int) { - return file_mapper_proto_rawDescGZIP(), []int{0, 2} -} - -func (x *Map_ListResponse) GetFuncs() []*FuncSpec { - if x != nil { - return x.Funcs - } - return nil -} - -var File_mapper_proto protoreflect.FileDescriptor - -var file_mapper_proto_rawDesc = []byte{ - 0x0a, 0x0c, 0x6d, 0x61, 0x70, 0x70, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, 0x70, - 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc3, 0x01, 0x0a, 0x03, - 0x4d, 0x61, 0x70, 0x1a, 0x4b, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, - 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x41, 0x72, - 0x67, 0x73, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x1a, 0x38, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x06, - 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, - 0x6e, 0x79, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x1a, 0x35, 0x0a, 0x0c, 0x4c, 0x69, - 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x05, 0x66, 0x75, - 0x6e, 0x63, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x52, 0x05, 0x66, 0x75, 0x6e, 0x63, - 0x73, 0x32, 0x78, 0x0a, 0x06, 0x4d, 0x61, 0x70, 0x70, 0x65, 0x72, 0x12, 0x3e, 0x0a, 0x0b, 0x4c, - 0x69, 0x73, 0x74, 0x4d, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x61, 0x70, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2e, 0x0a, 0x03, 0x4d, - 0x61, 0x70, 0x12, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, 0x61, 0x70, 0x2e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4d, - 0x61, 0x70, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x09, 0x5a, 0x07, 0x2e, - 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_mapper_proto_rawDescOnce sync.Once - file_mapper_proto_rawDescData = file_mapper_proto_rawDesc -) - -func file_mapper_proto_rawDescGZIP() []byte { - file_mapper_proto_rawDescOnce.Do(func() { - file_mapper_proto_rawDescData = protoimpl.X.CompressGZIP(file_mapper_proto_rawDescData) - }) - return file_mapper_proto_rawDescData -} - -var file_mapper_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_mapper_proto_goTypes = []interface{}{ - (*Map)(nil), // 0: proto.Map - (*Map_Request)(nil), // 1: proto.Map.Request - (*Map_Response)(nil), // 2: proto.Map.Response - (*Map_ListResponse)(nil), // 3: proto.Map.ListResponse - (*FuncSpec_Args)(nil), // 4: proto.FuncSpec.Args - (*any.Any)(nil), // 5: google.protobuf.Any - (*FuncSpec)(nil), // 6: proto.FuncSpec - (*empty.Empty)(nil), // 7: google.protobuf.Empty -} -var file_mapper_proto_depIdxs = []int32{ - 4, // 0: proto.Map.Request.args:type_name -> proto.FuncSpec.Args - 5, // 1: proto.Map.Response.result:type_name -> google.protobuf.Any - 6, // 2: proto.Map.ListResponse.funcs:type_name -> proto.FuncSpec - 7, // 3: proto.Mapper.ListMappers:input_type -> google.protobuf.Empty - 1, // 4: proto.Mapper.Map:input_type -> proto.Map.Request - 3, // 5: proto.Mapper.ListMappers:output_type -> proto.Map.ListResponse - 2, // 6: proto.Mapper.Map:output_type -> proto.Map.Response - 5, // [5:7] is the sub-list for method output_type - 3, // [3:5] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_mapper_proto_init() } -func file_mapper_proto_init() { - if File_mapper_proto != nil { - return - } - file_plugin_proto_init() - if !protoimpl.UnsafeEnabled { - file_mapper_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Map); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_mapper_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Map_Request); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_mapper_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Map_Response); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_mapper_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Map_ListResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_mapper_proto_rawDesc, - NumEnums: 0, - NumMessages: 4, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_mapper_proto_goTypes, - DependencyIndexes: file_mapper_proto_depIdxs, - MessageInfos: file_mapper_proto_msgTypes, - }.Build() - File_mapper_proto = out.File - file_mapper_proto_rawDesc = nil - file_mapper_proto_goTypes = nil - file_mapper_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// MapperClient is the client API for Mapper service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MapperClient interface { - // ListMappers returns the list of mappers that this plugin supports. - ListMappers(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Map_ListResponse, error) - // Map executes a mapper. - Map(ctx context.Context, in *Map_Request, opts ...grpc.CallOption) (*Map_Response, error) -} - -type mapperClient struct { - cc grpc.ClientConnInterface -} - -func NewMapperClient(cc grpc.ClientConnInterface) MapperClient { - return &mapperClient{cc} -} - -func (c *mapperClient) ListMappers(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Map_ListResponse, error) { - out := new(Map_ListResponse) - err := c.cc.Invoke(ctx, "/proto.Mapper/ListMappers", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *mapperClient) Map(ctx context.Context, in *Map_Request, opts ...grpc.CallOption) (*Map_Response, error) { - out := new(Map_Response) - err := c.cc.Invoke(ctx, "/proto.Mapper/Map", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MapperServer is the server API for Mapper service. -type MapperServer interface { - // ListMappers returns the list of mappers that this plugin supports. - ListMappers(context.Context, *empty.Empty) (*Map_ListResponse, error) - // Map executes a mapper. - Map(context.Context, *Map_Request) (*Map_Response, error) -} - -// UnimplementedMapperServer can be embedded to have forward compatible implementations. -type UnimplementedMapperServer struct { -} - -func (*UnimplementedMapperServer) ListMappers(context.Context, *empty.Empty) (*Map_ListResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListMappers not implemented") -} -func (*UnimplementedMapperServer) Map(context.Context, *Map_Request) (*Map_Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Map not implemented") -} - -func RegisterMapperServer(s *grpc.Server, srv MapperServer) { - s.RegisterService(&_Mapper_serviceDesc, srv) -} - -func _Mapper_ListMappers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MapperServer).ListMappers(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Mapper/ListMappers", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MapperServer).ListMappers(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Mapper_Map_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Map_Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MapperServer).Map(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Mapper/Map", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MapperServer).Map(ctx, req.(*Map_Request)) - } - return interceptor(ctx, in, info, handler) -} - -var _Mapper_serviceDesc = grpc.ServiceDesc{ - ServiceName: "proto.Mapper", - HandlerType: (*MapperServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "ListMappers", - Handler: _Mapper_ListMappers_Handler, - }, - { - MethodName: "Map", - Handler: _Mapper_Map_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "mapper.proto", -} diff --git a/sdk/proto/mapper.proto b/sdk/proto/mapper.proto deleted file mode 100644 index 78e28bdac51..00000000000 --- a/sdk/proto/mapper.proto +++ /dev/null @@ -1,40 +0,0 @@ -syntax = "proto3"; - -package proto; - -option go_package = ".;proto"; - -import "google/protobuf/any.proto"; -import "google/protobuf/empty.proto"; -import "plugin.proto"; - -// Mapper is a specialized type of plugin that provides type mappers -// to convert to/from various types. -service Mapper { - // ListMappers returns the list of mappers that this plugin supports. - rpc ListMappers(google.protobuf.Empty) returns (Map.ListResponse); - - // Map executes a mapper. - rpc Map(Map.Request) returns (Map.Response); -} - -message Map { - message Request { - // args is the list of argument types. - FuncSpec.Args args = 1; - - // result is the desired result type. - string result = 2; - } - - message Response { - // result is the mapped data type that matches the type expected - // by the MapRequest.result field. - google.protobuf.Any result = 1; - } - - message ListResponse { - // FuncSpec - repeated FuncSpec funcs = 1; - } -} diff --git a/sdk/proto/platform.pb.go b/sdk/proto/platform.pb.go deleted file mode 100644 index ed77bb4a5fa..00000000000 --- a/sdk/proto/platform.pb.go +++ /dev/null @@ -1,1187 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v3.11.2 -// source: platform.proto - -package proto - -import ( - context "context" - proto "github.com/golang/protobuf/proto" - any "github.com/golang/protobuf/ptypes/any" - empty "github.com/golang/protobuf/ptypes/empty" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type DefaultReleaser struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *DefaultReleaser) Reset() { - *x = DefaultReleaser{} - if protoimpl.UnsafeEnabled { - mi := &file_platform_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DefaultReleaser) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DefaultReleaser) ProtoMessage() {} - -func (x *DefaultReleaser) ProtoReflect() protoreflect.Message { - mi := &file_platform_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DefaultReleaser.ProtoReflect.Descriptor instead. -func (*DefaultReleaser) Descriptor() ([]byte, []int) { - return file_platform_proto_rawDescGZIP(), []int{0} -} - -type Deploy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *Deploy) Reset() { - *x = Deploy{} - if protoimpl.UnsafeEnabled { - mi := &file_platform_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Deploy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Deploy) ProtoMessage() {} - -func (x *Deploy) ProtoReflect() protoreflect.Message { - mi := &file_platform_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Deploy.ProtoReflect.Descriptor instead. -func (*Deploy) Descriptor() ([]byte, []int) { - return file_platform_proto_rawDescGZIP(), []int{1} -} - -type DefaultReleaser_Resp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // stream_id is the stream ID to connect to to get access to the - // ReleaseManager implementation. - StreamId uint32 `protobuf:"varint,1,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"` -} - -func (x *DefaultReleaser_Resp) Reset() { - *x = DefaultReleaser_Resp{} - if protoimpl.UnsafeEnabled { - mi := &file_platform_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DefaultReleaser_Resp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DefaultReleaser_Resp) ProtoMessage() {} - -func (x *DefaultReleaser_Resp) ProtoReflect() protoreflect.Message { - mi := &file_platform_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DefaultReleaser_Resp.ProtoReflect.Descriptor instead. -func (*DefaultReleaser_Resp) Descriptor() ([]byte, []int) { - return file_platform_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *DefaultReleaser_Resp) GetStreamId() uint32 { - if x != nil { - return x.StreamId - } - return 0 -} - -type Deploy_Resp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // result is the resulting opaque data type - Result *any.Any `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` -} - -func (x *Deploy_Resp) Reset() { - *x = Deploy_Resp{} - if protoimpl.UnsafeEnabled { - mi := &file_platform_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Deploy_Resp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Deploy_Resp) ProtoMessage() {} - -func (x *Deploy_Resp) ProtoReflect() protoreflect.Message { - mi := &file_platform_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Deploy_Resp.ProtoReflect.Descriptor instead. -func (*Deploy_Resp) Descriptor() ([]byte, []int) { - return file_platform_proto_rawDescGZIP(), []int{1, 0} -} - -func (x *Deploy_Resp) GetResult() *any.Any { - if x != nil { - return x.Result - } - return nil -} - -var File_platform_proto protoreflect.FileDescriptor - -var file_platform_proto_rawDesc = []byte{ - 0x0a, 0x0e, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x0c, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x36, 0x0a, - 0x0f, 0x44, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x72, - 0x1a, 0x23, 0x0a, 0x04, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x73, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x49, 0x64, 0x22, 0x3e, 0x0a, 0x06, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x1a, - 0x34, 0x0a, 0x04, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2c, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x06, 0x72, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x32, 0xa1, 0x09, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, - 0x72, 0x6d, 0x12, 0x40, 0x0a, 0x0f, 0x49, 0x73, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, - 0x63, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x15, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x12, 0x36, 0x0a, 0x04, 0x41, 0x75, 0x74, 0x68, 0x12, 0x14, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x41, 0x72, - 0x67, 0x73, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x2e, - 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x08, - 0x41, 0x75, 0x74, 0x68, 0x53, 0x70, 0x65, 0x63, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, - 0x63, 0x12, 0x3c, 0x0a, 0x0c, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, - 0x68, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, - 0x65, 0x63, 0x2e, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, - 0x3b, 0x0a, 0x10, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x53, - 0x70, 0x65, 0x63, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x12, 0x40, 0x0a, 0x0c, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x16, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x43, - 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x12, 0x1e, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x12, 0x44, 0x0a, 0x0d, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1b, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x44, 0x6f, 0x63, 0x75, - 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x0a, 0x0a, 0x44, 0x65, 0x70, - 0x6c, 0x6f, 0x79, 0x53, 0x70, 0x65, 0x63, 0x12, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, - 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x12, 0x32, 0x0a, 0x06, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, - 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, - 0x63, 0x2e, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, - 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3e, 0x0a, 0x13, 0x44, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x72, 0x53, 0x70, 0x65, - 0x63, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x12, 0x44, 0x0a, 0x0f, 0x44, 0x65, - 0x66, 0x61, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x72, 0x12, 0x14, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x41, - 0x72, 0x67, 0x73, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x66, 0x61, - 0x75, 0x6c, 0x74, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x72, 0x2e, 0x52, 0x65, 0x73, 0x70, - 0x12, 0x3c, 0x0a, 0x0b, 0x49, 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x65, 0x72, 0x12, - 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x49, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x36, - 0x0a, 0x0b, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x53, 0x70, 0x65, 0x63, 0x12, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, - 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x12, 0x37, 0x0a, 0x07, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, - 0x79, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, - 0x65, 0x63, 0x2e, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, - 0x45, 0x0a, 0x14, 0x49, 0x73, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x44, 0x65, - 0x73, 0x74, 0x72, 0x6f, 0x79, 0x65, 0x72, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, - 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3f, 0x0a, 0x14, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, - 0x79, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x70, 0x65, 0x63, 0x12, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, - 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x12, 0x40, 0x0a, 0x10, 0x44, 0x65, 0x73, 0x74, 0x72, - 0x6f, 0x79, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x14, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x41, 0x72, 0x67, - 0x73, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x3e, 0x0a, 0x0d, 0x49, 0x73, 0x4c, - 0x6f, 0x67, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6d, 0x70, 0x6c, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_platform_proto_rawDescOnce sync.Once - file_platform_proto_rawDescData = file_platform_proto_rawDesc -) - -func file_platform_proto_rawDescGZIP() []byte { - file_platform_proto_rawDescOnce.Do(func() { - file_platform_proto_rawDescData = protoimpl.X.CompressGZIP(file_platform_proto_rawDescData) - }) - return file_platform_proto_rawDescData -} - -var file_platform_proto_msgTypes = make([]protoimpl.MessageInfo, 4) -var file_platform_proto_goTypes = []interface{}{ - (*DefaultReleaser)(nil), // 0: proto.DefaultReleaser - (*Deploy)(nil), // 1: proto.Deploy - (*DefaultReleaser_Resp)(nil), // 2: proto.DefaultReleaser.Resp - (*Deploy_Resp)(nil), // 3: proto.Deploy.Resp - (*any.Any)(nil), // 4: google.protobuf.Any - (*empty.Empty)(nil), // 5: google.protobuf.Empty - (*FuncSpec_Args)(nil), // 6: proto.FuncSpec.Args - (*Config_ConfigureRequest)(nil), // 7: proto.Config.ConfigureRequest - (*Empty)(nil), // 8: proto.Empty - (*ImplementsResp)(nil), // 9: proto.ImplementsResp - (*Auth_AuthResponse)(nil), // 10: proto.Auth.AuthResponse - (*FuncSpec)(nil), // 11: proto.FuncSpec - (*Config_StructResp)(nil), // 12: proto.Config.StructResp - (*Config_Documentation)(nil), // 13: proto.Config.Documentation -} -var file_platform_proto_depIdxs = []int32{ - 4, // 0: proto.Deploy.Resp.result:type_name -> google.protobuf.Any - 5, // 1: proto.Platform.IsAuthenticator:input_type -> google.protobuf.Empty - 6, // 2: proto.Platform.Auth:input_type -> proto.FuncSpec.Args - 5, // 3: proto.Platform.AuthSpec:input_type -> google.protobuf.Empty - 6, // 4: proto.Platform.ValidateAuth:input_type -> proto.FuncSpec.Args - 5, // 5: proto.Platform.ValidateAuthSpec:input_type -> google.protobuf.Empty - 5, // 6: proto.Platform.ConfigStruct:input_type -> google.protobuf.Empty - 7, // 7: proto.Platform.Configure:input_type -> proto.Config.ConfigureRequest - 5, // 8: proto.Platform.Documentation:input_type -> google.protobuf.Empty - 8, // 9: proto.Platform.DeploySpec:input_type -> proto.Empty - 6, // 10: proto.Platform.Deploy:input_type -> proto.FuncSpec.Args - 5, // 11: proto.Platform.DefaultReleaserSpec:input_type -> google.protobuf.Empty - 6, // 12: proto.Platform.DefaultReleaser:input_type -> proto.FuncSpec.Args - 5, // 13: proto.Platform.IsDestroyer:input_type -> google.protobuf.Empty - 5, // 14: proto.Platform.DestroySpec:input_type -> google.protobuf.Empty - 6, // 15: proto.Platform.Destroy:input_type -> proto.FuncSpec.Args - 5, // 16: proto.Platform.IsWorkspaceDestroyer:input_type -> google.protobuf.Empty - 5, // 17: proto.Platform.DestroyWorkspaceSpec:input_type -> google.protobuf.Empty - 6, // 18: proto.Platform.DestroyWorkspace:input_type -> proto.FuncSpec.Args - 5, // 19: proto.Platform.IsLogPlatform:input_type -> google.protobuf.Empty - 9, // 20: proto.Platform.IsAuthenticator:output_type -> proto.ImplementsResp - 10, // 21: proto.Platform.Auth:output_type -> proto.Auth.AuthResponse - 11, // 22: proto.Platform.AuthSpec:output_type -> proto.FuncSpec - 5, // 23: proto.Platform.ValidateAuth:output_type -> google.protobuf.Empty - 11, // 24: proto.Platform.ValidateAuthSpec:output_type -> proto.FuncSpec - 12, // 25: proto.Platform.ConfigStruct:output_type -> proto.Config.StructResp - 5, // 26: proto.Platform.Configure:output_type -> google.protobuf.Empty - 13, // 27: proto.Platform.Documentation:output_type -> proto.Config.Documentation - 11, // 28: proto.Platform.DeploySpec:output_type -> proto.FuncSpec - 3, // 29: proto.Platform.Deploy:output_type -> proto.Deploy.Resp - 11, // 30: proto.Platform.DefaultReleaserSpec:output_type -> proto.FuncSpec - 2, // 31: proto.Platform.DefaultReleaser:output_type -> proto.DefaultReleaser.Resp - 9, // 32: proto.Platform.IsDestroyer:output_type -> proto.ImplementsResp - 11, // 33: proto.Platform.DestroySpec:output_type -> proto.FuncSpec - 5, // 34: proto.Platform.Destroy:output_type -> google.protobuf.Empty - 9, // 35: proto.Platform.IsWorkspaceDestroyer:output_type -> proto.ImplementsResp - 11, // 36: proto.Platform.DestroyWorkspaceSpec:output_type -> proto.FuncSpec - 5, // 37: proto.Platform.DestroyWorkspace:output_type -> google.protobuf.Empty - 9, // 38: proto.Platform.IsLogPlatform:output_type -> proto.ImplementsResp - 20, // [20:39] is the sub-list for method output_type - 1, // [1:20] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_platform_proto_init() } -func file_platform_proto_init() { - if File_platform_proto != nil { - return - } - file_plugin_proto_init() - if !protoimpl.UnsafeEnabled { - file_platform_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DefaultReleaser); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_platform_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Deploy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_platform_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DefaultReleaser_Resp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_platform_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Deploy_Resp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_platform_proto_rawDesc, - NumEnums: 0, - NumMessages: 4, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_platform_proto_goTypes, - DependencyIndexes: file_platform_proto_depIdxs, - MessageInfos: file_platform_proto_msgTypes, - }.Build() - File_platform_proto = out.File - file_platform_proto_rawDesc = nil - file_platform_proto_goTypes = nil - file_platform_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// PlatformClient is the client API for Platform service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type PlatformClient interface { - IsAuthenticator(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImplementsResp, error) - Auth(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*Auth_AuthResponse, error) - AuthSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) - ValidateAuth(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*empty.Empty, error) - ValidateAuthSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) - ConfigStruct(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Config_StructResp, error) - Configure(ctx context.Context, in *Config_ConfigureRequest, opts ...grpc.CallOption) (*empty.Empty, error) - Documentation(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Config_Documentation, error) - DeploySpec(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*FuncSpec, error) - Deploy(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*Deploy_Resp, error) - // component.PlatformReleaser optional implementation. - DefaultReleaserSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) - DefaultReleaser(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*DefaultReleaser_Resp, error) - // component.Destroyer optional implementation - IsDestroyer(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImplementsResp, error) - DestroySpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) - Destroy(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*empty.Empty, error) - // component.WorkspaceDestroyer optional implementation - IsWorkspaceDestroyer(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImplementsResp, error) - DestroyWorkspaceSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) - DestroyWorkspace(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*empty.Empty, error) - // IsLogPlatform returns true if this platform also implements LogPlatform. - IsLogPlatform(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImplementsResp, error) -} - -type platformClient struct { - cc grpc.ClientConnInterface -} - -func NewPlatformClient(cc grpc.ClientConnInterface) PlatformClient { - return &platformClient{cc} -} - -func (c *platformClient) IsAuthenticator(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImplementsResp, error) { - out := new(ImplementsResp) - err := c.cc.Invoke(ctx, "/proto.Platform/IsAuthenticator", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *platformClient) Auth(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*Auth_AuthResponse, error) { - out := new(Auth_AuthResponse) - err := c.cc.Invoke(ctx, "/proto.Platform/Auth", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *platformClient) AuthSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) { - out := new(FuncSpec) - err := c.cc.Invoke(ctx, "/proto.Platform/AuthSpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *platformClient) ValidateAuth(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/proto.Platform/ValidateAuth", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *platformClient) ValidateAuthSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) { - out := new(FuncSpec) - err := c.cc.Invoke(ctx, "/proto.Platform/ValidateAuthSpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *platformClient) ConfigStruct(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Config_StructResp, error) { - out := new(Config_StructResp) - err := c.cc.Invoke(ctx, "/proto.Platform/ConfigStruct", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *platformClient) Configure(ctx context.Context, in *Config_ConfigureRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/proto.Platform/Configure", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *platformClient) Documentation(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Config_Documentation, error) { - out := new(Config_Documentation) - err := c.cc.Invoke(ctx, "/proto.Platform/Documentation", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *platformClient) DeploySpec(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*FuncSpec, error) { - out := new(FuncSpec) - err := c.cc.Invoke(ctx, "/proto.Platform/DeploySpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *platformClient) Deploy(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*Deploy_Resp, error) { - out := new(Deploy_Resp) - err := c.cc.Invoke(ctx, "/proto.Platform/Deploy", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *platformClient) DefaultReleaserSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) { - out := new(FuncSpec) - err := c.cc.Invoke(ctx, "/proto.Platform/DefaultReleaserSpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *platformClient) DefaultReleaser(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*DefaultReleaser_Resp, error) { - out := new(DefaultReleaser_Resp) - err := c.cc.Invoke(ctx, "/proto.Platform/DefaultReleaser", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *platformClient) IsDestroyer(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImplementsResp, error) { - out := new(ImplementsResp) - err := c.cc.Invoke(ctx, "/proto.Platform/IsDestroyer", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *platformClient) DestroySpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) { - out := new(FuncSpec) - err := c.cc.Invoke(ctx, "/proto.Platform/DestroySpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *platformClient) Destroy(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/proto.Platform/Destroy", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *platformClient) IsWorkspaceDestroyer(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImplementsResp, error) { - out := new(ImplementsResp) - err := c.cc.Invoke(ctx, "/proto.Platform/IsWorkspaceDestroyer", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *platformClient) DestroyWorkspaceSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) { - out := new(FuncSpec) - err := c.cc.Invoke(ctx, "/proto.Platform/DestroyWorkspaceSpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *platformClient) DestroyWorkspace(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/proto.Platform/DestroyWorkspace", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *platformClient) IsLogPlatform(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImplementsResp, error) { - out := new(ImplementsResp) - err := c.cc.Invoke(ctx, "/proto.Platform/IsLogPlatform", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// PlatformServer is the server API for Platform service. -type PlatformServer interface { - IsAuthenticator(context.Context, *empty.Empty) (*ImplementsResp, error) - Auth(context.Context, *FuncSpec_Args) (*Auth_AuthResponse, error) - AuthSpec(context.Context, *empty.Empty) (*FuncSpec, error) - ValidateAuth(context.Context, *FuncSpec_Args) (*empty.Empty, error) - ValidateAuthSpec(context.Context, *empty.Empty) (*FuncSpec, error) - ConfigStruct(context.Context, *empty.Empty) (*Config_StructResp, error) - Configure(context.Context, *Config_ConfigureRequest) (*empty.Empty, error) - Documentation(context.Context, *empty.Empty) (*Config_Documentation, error) - DeploySpec(context.Context, *Empty) (*FuncSpec, error) - Deploy(context.Context, *FuncSpec_Args) (*Deploy_Resp, error) - // component.PlatformReleaser optional implementation. - DefaultReleaserSpec(context.Context, *empty.Empty) (*FuncSpec, error) - DefaultReleaser(context.Context, *FuncSpec_Args) (*DefaultReleaser_Resp, error) - // component.Destroyer optional implementation - IsDestroyer(context.Context, *empty.Empty) (*ImplementsResp, error) - DestroySpec(context.Context, *empty.Empty) (*FuncSpec, error) - Destroy(context.Context, *FuncSpec_Args) (*empty.Empty, error) - // component.WorkspaceDestroyer optional implementation - IsWorkspaceDestroyer(context.Context, *empty.Empty) (*ImplementsResp, error) - DestroyWorkspaceSpec(context.Context, *empty.Empty) (*FuncSpec, error) - DestroyWorkspace(context.Context, *FuncSpec_Args) (*empty.Empty, error) - // IsLogPlatform returns true if this platform also implements LogPlatform. - IsLogPlatform(context.Context, *empty.Empty) (*ImplementsResp, error) -} - -// UnimplementedPlatformServer can be embedded to have forward compatible implementations. -type UnimplementedPlatformServer struct { -} - -func (*UnimplementedPlatformServer) IsAuthenticator(context.Context, *empty.Empty) (*ImplementsResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method IsAuthenticator not implemented") -} -func (*UnimplementedPlatformServer) Auth(context.Context, *FuncSpec_Args) (*Auth_AuthResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Auth not implemented") -} -func (*UnimplementedPlatformServer) AuthSpec(context.Context, *empty.Empty) (*FuncSpec, error) { - return nil, status.Errorf(codes.Unimplemented, "method AuthSpec not implemented") -} -func (*UnimplementedPlatformServer) ValidateAuth(context.Context, *FuncSpec_Args) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateAuth not implemented") -} -func (*UnimplementedPlatformServer) ValidateAuthSpec(context.Context, *empty.Empty) (*FuncSpec, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateAuthSpec not implemented") -} -func (*UnimplementedPlatformServer) ConfigStruct(context.Context, *empty.Empty) (*Config_StructResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method ConfigStruct not implemented") -} -func (*UnimplementedPlatformServer) Configure(context.Context, *Config_ConfigureRequest) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method Configure not implemented") -} -func (*UnimplementedPlatformServer) Documentation(context.Context, *empty.Empty) (*Config_Documentation, error) { - return nil, status.Errorf(codes.Unimplemented, "method Documentation not implemented") -} -func (*UnimplementedPlatformServer) DeploySpec(context.Context, *Empty) (*FuncSpec, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeploySpec not implemented") -} -func (*UnimplementedPlatformServer) Deploy(context.Context, *FuncSpec_Args) (*Deploy_Resp, error) { - return nil, status.Errorf(codes.Unimplemented, "method Deploy not implemented") -} -func (*UnimplementedPlatformServer) DefaultReleaserSpec(context.Context, *empty.Empty) (*FuncSpec, error) { - return nil, status.Errorf(codes.Unimplemented, "method DefaultReleaserSpec not implemented") -} -func (*UnimplementedPlatformServer) DefaultReleaser(context.Context, *FuncSpec_Args) (*DefaultReleaser_Resp, error) { - return nil, status.Errorf(codes.Unimplemented, "method DefaultReleaser not implemented") -} -func (*UnimplementedPlatformServer) IsDestroyer(context.Context, *empty.Empty) (*ImplementsResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method IsDestroyer not implemented") -} -func (*UnimplementedPlatformServer) DestroySpec(context.Context, *empty.Empty) (*FuncSpec, error) { - return nil, status.Errorf(codes.Unimplemented, "method DestroySpec not implemented") -} -func (*UnimplementedPlatformServer) Destroy(context.Context, *FuncSpec_Args) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method Destroy not implemented") -} -func (*UnimplementedPlatformServer) IsWorkspaceDestroyer(context.Context, *empty.Empty) (*ImplementsResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method IsWorkspaceDestroyer not implemented") -} -func (*UnimplementedPlatformServer) DestroyWorkspaceSpec(context.Context, *empty.Empty) (*FuncSpec, error) { - return nil, status.Errorf(codes.Unimplemented, "method DestroyWorkspaceSpec not implemented") -} -func (*UnimplementedPlatformServer) DestroyWorkspace(context.Context, *FuncSpec_Args) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method DestroyWorkspace not implemented") -} -func (*UnimplementedPlatformServer) IsLogPlatform(context.Context, *empty.Empty) (*ImplementsResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method IsLogPlatform not implemented") -} - -func RegisterPlatformServer(s *grpc.Server, srv PlatformServer) { - s.RegisterService(&_Platform_serviceDesc, srv) -} - -func _Platform_IsAuthenticator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).IsAuthenticator(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/IsAuthenticator", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).IsAuthenticator(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Platform_Auth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FuncSpec_Args) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).Auth(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/Auth", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).Auth(ctx, req.(*FuncSpec_Args)) - } - return interceptor(ctx, in, info, handler) -} - -func _Platform_AuthSpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).AuthSpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/AuthSpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).AuthSpec(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Platform_ValidateAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FuncSpec_Args) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).ValidateAuth(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/ValidateAuth", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).ValidateAuth(ctx, req.(*FuncSpec_Args)) - } - return interceptor(ctx, in, info, handler) -} - -func _Platform_ValidateAuthSpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).ValidateAuthSpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/ValidateAuthSpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).ValidateAuthSpec(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Platform_ConfigStruct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).ConfigStruct(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/ConfigStruct", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).ConfigStruct(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Platform_Configure_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Config_ConfigureRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).Configure(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/Configure", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).Configure(ctx, req.(*Config_ConfigureRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Platform_Documentation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).Documentation(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/Documentation", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).Documentation(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Platform_DeploySpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).DeploySpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/DeploySpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).DeploySpec(ctx, req.(*Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Platform_Deploy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FuncSpec_Args) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).Deploy(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/Deploy", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).Deploy(ctx, req.(*FuncSpec_Args)) - } - return interceptor(ctx, in, info, handler) -} - -func _Platform_DefaultReleaserSpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).DefaultReleaserSpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/DefaultReleaserSpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).DefaultReleaserSpec(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Platform_DefaultReleaser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FuncSpec_Args) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).DefaultReleaser(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/DefaultReleaser", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).DefaultReleaser(ctx, req.(*FuncSpec_Args)) - } - return interceptor(ctx, in, info, handler) -} - -func _Platform_IsDestroyer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).IsDestroyer(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/IsDestroyer", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).IsDestroyer(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Platform_DestroySpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).DestroySpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/DestroySpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).DestroySpec(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Platform_Destroy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FuncSpec_Args) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).Destroy(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/Destroy", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).Destroy(ctx, req.(*FuncSpec_Args)) - } - return interceptor(ctx, in, info, handler) -} - -func _Platform_IsWorkspaceDestroyer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).IsWorkspaceDestroyer(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/IsWorkspaceDestroyer", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).IsWorkspaceDestroyer(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Platform_DestroyWorkspaceSpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).DestroyWorkspaceSpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/DestroyWorkspaceSpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).DestroyWorkspaceSpec(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Platform_DestroyWorkspace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FuncSpec_Args) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).DestroyWorkspace(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/DestroyWorkspace", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).DestroyWorkspace(ctx, req.(*FuncSpec_Args)) - } - return interceptor(ctx, in, info, handler) -} - -func _Platform_IsLogPlatform_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PlatformServer).IsLogPlatform(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Platform/IsLogPlatform", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PlatformServer).IsLogPlatform(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -var _Platform_serviceDesc = grpc.ServiceDesc{ - ServiceName: "proto.Platform", - HandlerType: (*PlatformServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "IsAuthenticator", - Handler: _Platform_IsAuthenticator_Handler, - }, - { - MethodName: "Auth", - Handler: _Platform_Auth_Handler, - }, - { - MethodName: "AuthSpec", - Handler: _Platform_AuthSpec_Handler, - }, - { - MethodName: "ValidateAuth", - Handler: _Platform_ValidateAuth_Handler, - }, - { - MethodName: "ValidateAuthSpec", - Handler: _Platform_ValidateAuthSpec_Handler, - }, - { - MethodName: "ConfigStruct", - Handler: _Platform_ConfigStruct_Handler, - }, - { - MethodName: "Configure", - Handler: _Platform_Configure_Handler, - }, - { - MethodName: "Documentation", - Handler: _Platform_Documentation_Handler, - }, - { - MethodName: "DeploySpec", - Handler: _Platform_DeploySpec_Handler, - }, - { - MethodName: "Deploy", - Handler: _Platform_Deploy_Handler, - }, - { - MethodName: "DefaultReleaserSpec", - Handler: _Platform_DefaultReleaserSpec_Handler, - }, - { - MethodName: "DefaultReleaser", - Handler: _Platform_DefaultReleaser_Handler, - }, - { - MethodName: "IsDestroyer", - Handler: _Platform_IsDestroyer_Handler, - }, - { - MethodName: "DestroySpec", - Handler: _Platform_DestroySpec_Handler, - }, - { - MethodName: "Destroy", - Handler: _Platform_Destroy_Handler, - }, - { - MethodName: "IsWorkspaceDestroyer", - Handler: _Platform_IsWorkspaceDestroyer_Handler, - }, - { - MethodName: "DestroyWorkspaceSpec", - Handler: _Platform_DestroyWorkspaceSpec_Handler, - }, - { - MethodName: "DestroyWorkspace", - Handler: _Platform_DestroyWorkspace_Handler, - }, - { - MethodName: "IsLogPlatform", - Handler: _Platform_IsLogPlatform_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "platform.proto", -} diff --git a/sdk/proto/platform.proto b/sdk/proto/platform.proto deleted file mode 100644 index 79b77fc3f71..00000000000 --- a/sdk/proto/platform.proto +++ /dev/null @@ -1,57 +0,0 @@ -syntax = "proto3"; - -package proto; - -option go_package = ".;proto"; - -import "google/protobuf/any.proto"; -import "google/protobuf/empty.proto"; -import "plugin.proto"; - -// Platform is responsible for deploying an artifact that is in a registry. -service Platform { - rpc IsAuthenticator(google.protobuf.Empty) returns (ImplementsResp); - rpc Auth(FuncSpec.Args) returns (Auth.AuthResponse); - rpc AuthSpec(google.protobuf.Empty) returns (FuncSpec); - rpc ValidateAuth(FuncSpec.Args) returns (google.protobuf.Empty); - rpc ValidateAuthSpec(google.protobuf.Empty) returns (FuncSpec); - - rpc ConfigStruct(google.protobuf.Empty) returns (Config.StructResp); - rpc Configure(Config.ConfigureRequest) returns (google.protobuf.Empty); - rpc Documentation(google.protobuf.Empty) returns (Config.Documentation); - - rpc DeploySpec(Empty) returns (FuncSpec); - rpc Deploy(FuncSpec.Args) returns (Deploy.Resp); - - // component.PlatformReleaser optional implementation. - rpc DefaultReleaserSpec(google.protobuf.Empty) returns (FuncSpec); - rpc DefaultReleaser(FuncSpec.Args) returns (DefaultReleaser.Resp); - - // component.Destroyer optional implementation - rpc IsDestroyer(google.protobuf.Empty) returns (ImplementsResp); - rpc DestroySpec(google.protobuf.Empty) returns (FuncSpec); - rpc Destroy(FuncSpec.Args) returns (google.protobuf.Empty); - - // component.WorkspaceDestroyer optional implementation - rpc IsWorkspaceDestroyer(google.protobuf.Empty) returns (ImplementsResp); - rpc DestroyWorkspaceSpec(google.protobuf.Empty) returns (FuncSpec); - rpc DestroyWorkspace(FuncSpec.Args) returns (google.protobuf.Empty); - - // IsLogPlatform returns true if this platform also implements LogPlatform. - rpc IsLogPlatform(google.protobuf.Empty) returns (ImplementsResp); -} - -message DefaultReleaser { - message Resp { - // stream_id is the stream ID to connect to to get access to the - // ReleaseManager implementation. - uint32 stream_id = 1; - } -} - -message Deploy { - message Resp { - // result is the resulting opaque data type - google.protobuf.Any result = 1; - } -} diff --git a/sdk/proto/plugin.pb.go b/sdk/proto/plugin.pb.go deleted file mode 100644 index 8d28f8bbc2d..00000000000 --- a/sdk/proto/plugin.pb.go +++ /dev/null @@ -1,2102 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v3.11.2 -// source: plugin.proto - -package proto - -import ( - proto "github.com/golang/protobuf/proto" - any "github.com/golang/protobuf/ptypes/any" - protostructure "github.com/mitchellh/protostructure" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -// Args are the common argument types that are available to many of the -// dynamic functions. The exact list of available argument types is available -// on the Go interface docs. -type Args struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *Args) Reset() { - *x = Args{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Args) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Args) ProtoMessage() {} - -func (x *Args) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Args.ProtoReflect.Descriptor instead. -func (*Args) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{0} -} - -// Empty is just an empty message useful with some RPC endpoints. -type Empty struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *Empty) Reset() { - *x = Empty{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Empty) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Empty) ProtoMessage() {} - -func (x *Empty) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Empty.ProtoReflect.Descriptor instead. -func (*Empty) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{1} -} - -// FuncSpec describes a function and is used by the dependency-injection -// framework to provide the function with the proper values. -// -// Value types are specified using strings. Built-in framework types -// are defined via constants in the `sdk` package. For custom types, you -// can use whatever string as long as it is unique. We recommend using a -// unique prefix plus the Go type name. -type FuncSpec struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // name of the function. This is used for improved logging. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // args is the list of arguments by protobuf Any types. - Args []*FuncSpec_Value `protobuf:"bytes,2,rep,name=args,proto3" json:"args,omitempty"` - // result are the resulting types that are made available. This is only - // critically important to be set for functions that may chain to other - // functions. It can be set to blank in which case it will not be used. - Result []*FuncSpec_Value `protobuf:"bytes,3,rep,name=result,proto3" json:"result,omitempty"` -} - -func (x *FuncSpec) Reset() { - *x = FuncSpec{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FuncSpec) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FuncSpec) ProtoMessage() {} - -func (x *FuncSpec) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FuncSpec.ProtoReflect.Descriptor instead. -func (*FuncSpec) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{2} -} - -func (x *FuncSpec) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *FuncSpec) GetArgs() []*FuncSpec_Value { - if x != nil { - return x.Args - } - return nil -} - -func (x *FuncSpec) GetResult() []*FuncSpec_Value { - if x != nil { - return x.Result - } - return nil -} - -// Config is the namespace of messages related to configuration. -// -// All components that take configuration are expected to have two RPC calls: -// -// * ConfigStruct - Returns the configuration structure. -// * Configure - Sends the configuration data back to the plugin and the -// plugin is also expected to perform any validation at this stage. -// * Documentation - Returns a Documentation struct that details what configuration -// is accepted, with documentation. -// -type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *Config) Reset() { - *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Config) ProtoMessage() {} - -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{3} -} - -// Auth is the namespace of messages related to auth. -type Auth struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *Auth) Reset() { - *x = Auth{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Auth) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Auth) ProtoMessage() {} - -func (x *Auth) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Auth.ProtoReflect.Descriptor instead. -func (*Auth) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{4} -} - -// ImplementsResp returns true if the component implements an additional interface. -type ImplementsResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Implements bool `protobuf:"varint,1,opt,name=implements,proto3" json:"implements,omitempty"` -} - -func (x *ImplementsResp) Reset() { - *x = ImplementsResp{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ImplementsResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ImplementsResp) ProtoMessage() {} - -func (x *ImplementsResp) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ImplementsResp.ProtoReflect.Descriptor instead. -func (*ImplementsResp) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{5} -} - -func (x *ImplementsResp) GetImplements() bool { - if x != nil { - return x.Implements - } - return false -} - -// See component.Source -type Args_Source struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // app is the name of the application being deployed. - App string `protobuf:"bytes,1,opt,name=app,proto3" json:"app,omitempty"` - // path is the absolute directory path to the root directory for source files. - Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` -} - -func (x *Args_Source) Reset() { - *x = Args_Source{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Args_Source) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Args_Source) ProtoMessage() {} - -func (x *Args_Source) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Args_Source.ProtoReflect.Descriptor instead. -func (*Args_Source) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *Args_Source) GetApp() string { - if x != nil { - return x.App - } - return "" -} - -func (x *Args_Source) GetPath() string { - if x != nil { - return x.Path - } - return "" -} - -// See component.JobInfo -type Args_JobInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Local bool `protobuf:"varint,1,opt,name=local,proto3" json:"local,omitempty"` - Workspace string `protobuf:"bytes,2,opt,name=workspace,proto3" json:"workspace,omitempty"` - Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` -} - -func (x *Args_JobInfo) Reset() { - *x = Args_JobInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Args_JobInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Args_JobInfo) ProtoMessage() {} - -func (x *Args_JobInfo) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Args_JobInfo.ProtoReflect.Descriptor instead. -func (*Args_JobInfo) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{0, 1} -} - -func (x *Args_JobInfo) GetLocal() bool { - if x != nil { - return x.Local - } - return false -} - -func (x *Args_JobInfo) GetWorkspace() string { - if x != nil { - return x.Workspace - } - return "" -} - -func (x *Args_JobInfo) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -// See component.DeploymentConfig -type Args_DeploymentConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - ServerAddr string `protobuf:"bytes,2,opt,name=server_addr,json=serverAddr,proto3" json:"server_addr,omitempty"` - ServerTls bool `protobuf:"varint,3,opt,name=server_tls,json=serverTls,proto3" json:"server_tls,omitempty"` - ServerTlsSkipVerify bool `protobuf:"varint,4,opt,name=server_tls_skip_verify,json=serverTlsSkipVerify,proto3" json:"server_tls_skip_verify,omitempty"` - EntrypointInviteToken string `protobuf:"bytes,5,opt,name=entrypoint_invite_token,json=entrypointInviteToken,proto3" json:"entrypoint_invite_token,omitempty"` -} - -func (x *Args_DeploymentConfig) Reset() { - *x = Args_DeploymentConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Args_DeploymentConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Args_DeploymentConfig) ProtoMessage() {} - -func (x *Args_DeploymentConfig) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Args_DeploymentConfig.ProtoReflect.Descriptor instead. -func (*Args_DeploymentConfig) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{0, 2} -} - -func (x *Args_DeploymentConfig) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *Args_DeploymentConfig) GetServerAddr() string { - if x != nil { - return x.ServerAddr - } - return "" -} - -func (x *Args_DeploymentConfig) GetServerTls() bool { - if x != nil { - return x.ServerTls - } - return false -} - -func (x *Args_DeploymentConfig) GetServerTlsSkipVerify() bool { - if x != nil { - return x.ServerTlsSkipVerify - } - return false -} - -func (x *Args_DeploymentConfig) GetEntrypointInviteToken() string { - if x != nil { - return x.EntrypointInviteToken - } - return "" -} - -// DataDir represents the directory where data can be stored. This is an internal -// struct and shouldn't be used directly. Use the relevant *datadir implementation -// instead. -type Args_DataDir struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *Args_DataDir) Reset() { - *x = Args_DataDir{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Args_DataDir) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Args_DataDir) ProtoMessage() {} - -func (x *Args_DataDir) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Args_DataDir.ProtoReflect.Descriptor instead. -func (*Args_DataDir) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{0, 3} -} - -// Logger is used to construct an logger for the plugin. -type Args_Logger struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // name is the name of the logger - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` -} - -func (x *Args_Logger) Reset() { - *x = Args_Logger{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Args_Logger) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Args_Logger) ProtoMessage() {} - -func (x *Args_Logger) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Args_Logger.ProtoReflect.Descriptor instead. -func (*Args_Logger) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{0, 4} -} - -func (x *Args_Logger) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -// TerminalUI is used to construct the terminal.UI for the plugin. -type Args_TerminalUI struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - StreamId uint32 `protobuf:"varint,1,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"` -} - -func (x *Args_TerminalUI) Reset() { - *x = Args_TerminalUI{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Args_TerminalUI) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Args_TerminalUI) ProtoMessage() {} - -func (x *Args_TerminalUI) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Args_TerminalUI.ProtoReflect.Descriptor instead. -func (*Args_TerminalUI) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{0, 5} -} - -func (x *Args_TerminalUI) GetStreamId() uint32 { - if x != nil { - return x.StreamId - } - return 0 -} - -// HistoryClient is used to serve the history client for the plugin. -type Args_HistoryClient struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - StreamId uint32 `protobuf:"varint,1,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"` -} - -func (x *Args_HistoryClient) Reset() { - *x = Args_HistoryClient{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Args_HistoryClient) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Args_HistoryClient) ProtoMessage() {} - -func (x *Args_HistoryClient) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Args_HistoryClient.ProtoReflect.Descriptor instead. -func (*Args_HistoryClient) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{0, 6} -} - -func (x *Args_HistoryClient) GetStreamId() uint32 { - if x != nil { - return x.StreamId - } - return 0 -} - -// ReleaseTargets is the set of targets for a release operation. -type Args_ReleaseTargets struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The set of targets for a release. This is always guaranteed by - // the caller to sum to 100%. If the release component doesn't support - // traffic splitting, this is guaranteed to always be length 1. - Targets []*Args_ReleaseTargets_Target `protobuf:"bytes,1,rep,name=targets,proto3" json:"targets,omitempty"` -} - -func (x *Args_ReleaseTargets) Reset() { - *x = Args_ReleaseTargets{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Args_ReleaseTargets) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Args_ReleaseTargets) ProtoMessage() {} - -func (x *Args_ReleaseTargets) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Args_ReleaseTargets.ProtoReflect.Descriptor instead. -func (*Args_ReleaseTargets) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{0, 7} -} - -func (x *Args_ReleaseTargets) GetTargets() []*Args_ReleaseTargets_Target { - if x != nil { - return x.Targets - } - return nil -} - -// LabelSet is a set of labels for anything that can be labelled, such -// as a deployment, build, etc. -type Args_LabelSet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Labels map[string]string `protobuf:"bytes,1,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *Args_LabelSet) Reset() { - *x = Args_LabelSet{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Args_LabelSet) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Args_LabelSet) ProtoMessage() {} - -func (x *Args_LabelSet) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Args_LabelSet.ProtoReflect.Descriptor instead. -func (*Args_LabelSet) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{0, 8} -} - -func (x *Args_LabelSet) GetLabels() map[string]string { - if x != nil { - return x.Labels - } - return nil -} - -type Args_DataDir_Project struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CacheDir string `protobuf:"bytes,2,opt,name=cache_dir,json=cacheDir,proto3" json:"cache_dir,omitempty"` - DataDir string `protobuf:"bytes,3,opt,name=data_dir,json=dataDir,proto3" json:"data_dir,omitempty"` -} - -func (x *Args_DataDir_Project) Reset() { - *x = Args_DataDir_Project{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Args_DataDir_Project) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Args_DataDir_Project) ProtoMessage() {} - -func (x *Args_DataDir_Project) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Args_DataDir_Project.ProtoReflect.Descriptor instead. -func (*Args_DataDir_Project) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{0, 3, 0} -} - -func (x *Args_DataDir_Project) GetCacheDir() string { - if x != nil { - return x.CacheDir - } - return "" -} - -func (x *Args_DataDir_Project) GetDataDir() string { - if x != nil { - return x.DataDir - } - return "" -} - -type Args_DataDir_App struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CacheDir string `protobuf:"bytes,2,opt,name=cache_dir,json=cacheDir,proto3" json:"cache_dir,omitempty"` - DataDir string `protobuf:"bytes,3,opt,name=data_dir,json=dataDir,proto3" json:"data_dir,omitempty"` -} - -func (x *Args_DataDir_App) Reset() { - *x = Args_DataDir_App{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Args_DataDir_App) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Args_DataDir_App) ProtoMessage() {} - -func (x *Args_DataDir_App) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Args_DataDir_App.ProtoReflect.Descriptor instead. -func (*Args_DataDir_App) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{0, 3, 1} -} - -func (x *Args_DataDir_App) GetCacheDir() string { - if x != nil { - return x.CacheDir - } - return "" -} - -func (x *Args_DataDir_App) GetDataDir() string { - if x != nil { - return x.DataDir - } - return "" -} - -type Args_DataDir_Component struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - CacheDir string `protobuf:"bytes,2,opt,name=cache_dir,json=cacheDir,proto3" json:"cache_dir,omitempty"` - DataDir string `protobuf:"bytes,3,opt,name=data_dir,json=dataDir,proto3" json:"data_dir,omitempty"` -} - -func (x *Args_DataDir_Component) Reset() { - *x = Args_DataDir_Component{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Args_DataDir_Component) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Args_DataDir_Component) ProtoMessage() {} - -func (x *Args_DataDir_Component) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[17] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Args_DataDir_Component.ProtoReflect.Descriptor instead. -func (*Args_DataDir_Component) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{0, 3, 2} -} - -func (x *Args_DataDir_Component) GetCacheDir() string { - if x != nil { - return x.CacheDir - } - return "" -} - -func (x *Args_DataDir_Component) GetDataDir() string { - if x != nil { - return x.DataDir - } - return "" -} - -// Target is a single target for releasing. -type Args_ReleaseTargets_Target struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Deployment *any.Any `protobuf:"bytes,1,opt,name=deployment,proto3" json:"deployment,omitempty"` - Percent uint32 `protobuf:"varint,2,opt,name=percent,proto3" json:"percent,omitempty"` -} - -func (x *Args_ReleaseTargets_Target) Reset() { - *x = Args_ReleaseTargets_Target{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Args_ReleaseTargets_Target) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Args_ReleaseTargets_Target) ProtoMessage() {} - -func (x *Args_ReleaseTargets_Target) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[18] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Args_ReleaseTargets_Target.ProtoReflect.Descriptor instead. -func (*Args_ReleaseTargets_Target) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{0, 7, 0} -} - -func (x *Args_ReleaseTargets_Target) GetDeployment() *any.Any { - if x != nil { - return x.Deployment - } - return nil -} - -func (x *Args_ReleaseTargets_Target) GetPercent() uint32 { - if x != nil { - return x.Percent - } - return 0 -} - -type FuncSpec_Value struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // name is the name of the argument. This may be empty for typed arguments. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // type is the type of the argument. All arguments must be encoded using - // *any.Any so this type specifies the proto Any message type and not - // a language-specific type. - Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` - // value is the value for this Value. This is only expected to be set - // for Args and has no impact on specs. - Value *any.Any `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *FuncSpec_Value) Reset() { - *x = FuncSpec_Value{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FuncSpec_Value) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FuncSpec_Value) ProtoMessage() {} - -func (x *FuncSpec_Value) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[20] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FuncSpec_Value.ProtoReflect.Descriptor instead. -func (*FuncSpec_Value) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{2, 0} -} - -func (x *FuncSpec_Value) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *FuncSpec_Value) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *FuncSpec_Value) GetValue() *any.Any { - if x != nil { - return x.Value - } - return nil -} - -// Args is the standard argument type for an RPC that is calling a FuncSpec. -type FuncSpec_Args struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // args is the list of arguments. This will include some of the - // standard types in this file (in the Args message namespace) as well - // as custom types declared by the FuncSpec that the plugin is expected - // to understand how to decode. - Args []*FuncSpec_Value `protobuf:"bytes,1,rep,name=args,proto3" json:"args,omitempty"` -} - -func (x *FuncSpec_Args) Reset() { - *x = FuncSpec_Args{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *FuncSpec_Args) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*FuncSpec_Args) ProtoMessage() {} - -func (x *FuncSpec_Args) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[21] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use FuncSpec_Args.ProtoReflect.Descriptor instead. -func (*FuncSpec_Args) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{2, 1} -} - -func (x *FuncSpec_Args) GetArgs() []*FuncSpec_Value { - if x != nil { - return x.Args - } - return nil -} - -// ConfigureRequest is the request sent once the configuration decoding -// is complete to actually assign the values to the structure. -type Config_ConfigureRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // json is the json data for the structure returned in the StructResp. - // It is guaranteed to decode cleanly into the target structure. - Json []byte `protobuf:"bytes,1,opt,name=json,proto3" json:"json,omitempty"` -} - -func (x *Config_ConfigureRequest) Reset() { - *x = Config_ConfigureRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config_ConfigureRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Config_ConfigureRequest) ProtoMessage() {} - -func (x *Config_ConfigureRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[22] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Config_ConfigureRequest.ProtoReflect.Descriptor instead. -func (*Config_ConfigureRequest) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{3, 0} -} - -func (x *Config_ConfigureRequest) GetJson() []byte { - if x != nil { - return x.Json - } - return nil -} - -// StructResp returns the struct for configuration. -type Config_StructResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // struct is the configuration structure (or empty/nil if one doesn't exist). - // This struct should have all the proper struct tags for HCL decoding - // You should do validation on the Configure call. - Struct *protostructure.Struct `protobuf:"bytes,1,opt,name=struct,proto3" json:"struct,omitempty"` -} - -func (x *Config_StructResp) Reset() { - *x = Config_StructResp{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config_StructResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Config_StructResp) ProtoMessage() {} - -func (x *Config_StructResp) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[23] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Config_StructResp.ProtoReflect.Descriptor instead. -func (*Config_StructResp) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{3, 1} -} - -func (x *Config_StructResp) GetStruct() *protostructure.Struct { - if x != nil { - return x.Struct - } - return nil -} - -type Config_FieldDocumentation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Synopsis string `protobuf:"bytes,2,opt,name=synopsis,proto3" json:"synopsis,omitempty"` - Summary string `protobuf:"bytes,3,opt,name=summary,proto3" json:"summary,omitempty"` - Optional bool `protobuf:"varint,4,opt,name=optional,proto3" json:"optional,omitempty"` - EnvVar string `protobuf:"bytes,5,opt,name=env_var,json=envVar,proto3" json:"env_var,omitempty"` - Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"` - Default string `protobuf:"bytes,7,opt,name=default,proto3" json:"default,omitempty"` -} - -func (x *Config_FieldDocumentation) Reset() { - *x = Config_FieldDocumentation{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config_FieldDocumentation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Config_FieldDocumentation) ProtoMessage() {} - -func (x *Config_FieldDocumentation) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[24] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Config_FieldDocumentation.ProtoReflect.Descriptor instead. -func (*Config_FieldDocumentation) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{3, 2} -} - -func (x *Config_FieldDocumentation) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Config_FieldDocumentation) GetSynopsis() string { - if x != nil { - return x.Synopsis - } - return "" -} - -func (x *Config_FieldDocumentation) GetSummary() string { - if x != nil { - return x.Summary - } - return "" -} - -func (x *Config_FieldDocumentation) GetOptional() bool { - if x != nil { - return x.Optional - } - return false -} - -func (x *Config_FieldDocumentation) GetEnvVar() string { - if x != nil { - return x.EnvVar - } - return "" -} - -func (x *Config_FieldDocumentation) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *Config_FieldDocumentation) GetDefault() string { - if x != nil { - return x.Default - } - return "" -} - -type Config_MapperDocumentation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Input string `protobuf:"bytes,1,opt,name=input,proto3" json:"input,omitempty"` - Output string `protobuf:"bytes,2,opt,name=output,proto3" json:"output,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` -} - -func (x *Config_MapperDocumentation) Reset() { - *x = Config_MapperDocumentation{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config_MapperDocumentation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Config_MapperDocumentation) ProtoMessage() {} - -func (x *Config_MapperDocumentation) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[25] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Config_MapperDocumentation.ProtoReflect.Descriptor instead. -func (*Config_MapperDocumentation) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{3, 3} -} - -func (x *Config_MapperDocumentation) GetInput() string { - if x != nil { - return x.Input - } - return "" -} - -func (x *Config_MapperDocumentation) GetOutput() string { - if x != nil { - return x.Output - } - return "" -} - -func (x *Config_MapperDocumentation) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -type Config_Documentation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - Example string `protobuf:"bytes,2,opt,name=example,proto3" json:"example,omitempty"` - Input string `protobuf:"bytes,3,opt,name=input,proto3" json:"input,omitempty"` - Output string `protobuf:"bytes,4,opt,name=output,proto3" json:"output,omitempty"` - Fields map[string]*Config_FieldDocumentation `protobuf:"bytes,5,rep,name=fields,proto3" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Mappers []*Config_MapperDocumentation `protobuf:"bytes,6,rep,name=mappers,proto3" json:"mappers,omitempty"` -} - -func (x *Config_Documentation) Reset() { - *x = Config_Documentation{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config_Documentation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Config_Documentation) ProtoMessage() {} - -func (x *Config_Documentation) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[26] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Config_Documentation.ProtoReflect.Descriptor instead. -func (*Config_Documentation) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{3, 4} -} - -func (x *Config_Documentation) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Config_Documentation) GetExample() string { - if x != nil { - return x.Example - } - return "" -} - -func (x *Config_Documentation) GetInput() string { - if x != nil { - return x.Input - } - return "" -} - -func (x *Config_Documentation) GetOutput() string { - if x != nil { - return x.Output - } - return "" -} - -func (x *Config_Documentation) GetFields() map[string]*Config_FieldDocumentation { - if x != nil { - return x.Fields - } - return nil -} - -func (x *Config_Documentation) GetMappers() []*Config_MapperDocumentation { - if x != nil { - return x.Mappers - } - return nil -} - -// AuthResponse is returned by the Auth functions. -type Auth_AuthResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Authenticated bool `protobuf:"varint,1,opt,name=authenticated,proto3" json:"authenticated,omitempty"` -} - -func (x *Auth_AuthResponse) Reset() { - *x = Auth_AuthResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_plugin_proto_msgTypes[28] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Auth_AuthResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Auth_AuthResponse) ProtoMessage() {} - -func (x *Auth_AuthResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_proto_msgTypes[28] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Auth_AuthResponse.ProtoReflect.Descriptor instead. -func (*Auth_AuthResponse) Descriptor() ([]byte, []int) { - return file_plugin_proto_rawDescGZIP(), []int{4, 0} -} - -func (x *Auth_AuthResponse) GetAuthenticated() bool { - if x != nil { - return x.Authenticated - } - return false -} - -var File_plugin_proto protoreflect.FileDescriptor - -var file_plugin_proto_rawDesc = []byte{ - 0x0a, 0x0c, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x14, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcc, 0x07, 0x0a, 0x04, 0x41, 0x72, 0x67, 0x73, 0x1a, - 0x2e, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x70, 0x70, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x61, 0x70, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x70, - 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x1a, - 0x4d, 0x0a, 0x07, 0x4a, 0x6f, 0x62, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x6f, - 0x63, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x6c, 0x6f, 0x63, 0x61, 0x6c, - 0x12, 0x1c, 0x0a, 0x09, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x1a, 0xcf, - 0x01, 0x0a, 0x10, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x61, 0x64, - 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x41, 0x64, 0x64, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x74, - 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x54, 0x6c, 0x73, 0x12, 0x33, 0x0a, 0x16, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x74, 0x6c, - 0x73, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x13, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x54, 0x6c, 0x73, 0x53, 0x6b, - 0x69, 0x70, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x12, 0x36, 0x0a, 0x17, 0x65, 0x6e, 0x74, 0x72, - 0x79, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x5f, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x65, 0x6e, 0x74, 0x72, 0x79, - 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x49, 0x6e, 0x76, 0x69, 0x74, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x1a, 0xd0, 0x01, 0x0a, 0x07, 0x44, 0x61, 0x74, 0x61, 0x44, 0x69, 0x72, 0x1a, 0x41, 0x0a, 0x07, - 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x61, 0x63, 0x68, 0x65, - 0x5f, 0x64, 0x69, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x61, 0x63, 0x68, - 0x65, 0x44, 0x69, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x64, 0x69, 0x72, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x61, 0x74, 0x61, 0x44, 0x69, 0x72, 0x1a, - 0x3d, 0x0a, 0x03, 0x41, 0x70, 0x70, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5f, - 0x64, 0x69, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x61, 0x63, 0x68, 0x65, - 0x44, 0x69, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x64, 0x69, 0x72, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x61, 0x74, 0x61, 0x44, 0x69, 0x72, 0x1a, 0x43, - 0x0a, 0x09, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x63, - 0x61, 0x63, 0x68, 0x65, 0x5f, 0x64, 0x69, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x63, 0x61, 0x63, 0x68, 0x65, 0x44, 0x69, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, - 0x5f, 0x64, 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x61, 0x74, 0x61, - 0x44, 0x69, 0x72, 0x1a, 0x1c, 0x0a, 0x06, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x1a, 0x29, 0x0a, 0x0a, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x49, 0x12, - 0x1b, 0x0a, 0x09, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x08, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x1a, 0x2c, 0x0a, 0x0d, - 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, - 0x09, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x08, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x1a, 0xa7, 0x01, 0x0a, 0x0e, 0x52, - 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x12, 0x3b, 0x0a, - 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x72, 0x67, 0x73, 0x2e, 0x52, 0x65, 0x6c, 0x65, - 0x61, 0x73, 0x65, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x52, 0x07, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x73, 0x1a, 0x58, 0x0a, 0x06, 0x54, 0x61, - 0x72, 0x67, 0x65, 0x74, 0x12, 0x34, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x0a, - 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x65, - 0x72, 0x63, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x70, 0x65, 0x72, - 0x63, 0x65, 0x6e, 0x74, 0x1a, 0x7f, 0x0a, 0x08, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x53, 0x65, 0x74, - 0x12, 0x38, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x72, 0x67, 0x73, 0x2e, 0x4c, 0x61, - 0x62, 0x65, 0x6c, 0x53, 0x65, 0x74, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, - 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x88, - 0x02, 0x0a, 0x08, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x29, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x2d, 0x0a, 0x06, 0x72, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x1a, 0x5b, 0x0a, 0x05, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x31, 0x0a, 0x04, 0x41, 0x72, 0x67, 0x73, 0x12, 0x29, - 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x22, 0xf0, 0x05, 0x0a, 0x06, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x1a, 0x26, 0x0a, 0x10, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6a, 0x73, 0x6f, 0x6e, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x6a, 0x73, 0x6f, 0x6e, 0x1a, 0x3c, 0x0a, 0x0a, - 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2e, 0x0a, 0x06, 0x73, 0x74, - 0x72, 0x75, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x2e, 0x53, 0x74, 0x72, 0x75, - 0x63, 0x74, 0x52, 0x06, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x1a, 0xc1, 0x01, 0x0a, 0x12, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x79, 0x6e, 0x6f, 0x70, 0x73, 0x69, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x79, 0x6e, 0x6f, 0x70, 0x73, 0x69, - 0x73, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x65, 0x6e, 0x76, 0x5f, 0x76, - 0x61, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, 0x6e, 0x76, 0x56, 0x61, 0x72, - 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x1a, 0x65, - 0x0a, 0x13, 0x4d, 0x61, 0x70, 0x70, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, - 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x75, 0x74, - 0x70, 0x75, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0xd4, 0x02, 0x0a, 0x0d, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, - 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, 0x61, - 0x6d, 0x70, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x78, 0x61, 0x6d, - 0x70, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, - 0x70, 0x75, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, - 0x74, 0x12, 0x3f, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x27, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, - 0x64, 0x73, 0x12, 0x3b, 0x0a, 0x07, 0x6d, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x65, 0x72, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, - 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x6d, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x1a, - 0x5b, 0x0a, 0x0b, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x36, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x3c, 0x0a, 0x04, - 0x41, 0x75, 0x74, 0x68, 0x1a, 0x34, 0x0a, 0x0c, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, - 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x61, 0x75, 0x74, - 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x22, 0x30, 0x0a, 0x0e, 0x49, 0x6d, - 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x0a, - 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0a, 0x69, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x42, 0x09, 0x5a, 0x07, - 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_plugin_proto_rawDescOnce sync.Once - file_plugin_proto_rawDescData = file_plugin_proto_rawDesc -) - -func file_plugin_proto_rawDescGZIP() []byte { - file_plugin_proto_rawDescOnce.Do(func() { - file_plugin_proto_rawDescData = protoimpl.X.CompressGZIP(file_plugin_proto_rawDescData) - }) - return file_plugin_proto_rawDescData -} - -var file_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 29) -var file_plugin_proto_goTypes = []interface{}{ - (*Args)(nil), // 0: proto.Args - (*Empty)(nil), // 1: proto.Empty - (*FuncSpec)(nil), // 2: proto.FuncSpec - (*Config)(nil), // 3: proto.Config - (*Auth)(nil), // 4: proto.Auth - (*ImplementsResp)(nil), // 5: proto.ImplementsResp - (*Args_Source)(nil), // 6: proto.Args.Source - (*Args_JobInfo)(nil), // 7: proto.Args.JobInfo - (*Args_DeploymentConfig)(nil), // 8: proto.Args.DeploymentConfig - (*Args_DataDir)(nil), // 9: proto.Args.DataDir - (*Args_Logger)(nil), // 10: proto.Args.Logger - (*Args_TerminalUI)(nil), // 11: proto.Args.TerminalUI - (*Args_HistoryClient)(nil), // 12: proto.Args.HistoryClient - (*Args_ReleaseTargets)(nil), // 13: proto.Args.ReleaseTargets - (*Args_LabelSet)(nil), // 14: proto.Args.LabelSet - (*Args_DataDir_Project)(nil), // 15: proto.Args.DataDir.Project - (*Args_DataDir_App)(nil), // 16: proto.Args.DataDir.App - (*Args_DataDir_Component)(nil), // 17: proto.Args.DataDir.Component - (*Args_ReleaseTargets_Target)(nil), // 18: proto.Args.ReleaseTargets.Target - nil, // 19: proto.Args.LabelSet.LabelsEntry - (*FuncSpec_Value)(nil), // 20: proto.FuncSpec.Value - (*FuncSpec_Args)(nil), // 21: proto.FuncSpec.Args - (*Config_ConfigureRequest)(nil), // 22: proto.Config.ConfigureRequest - (*Config_StructResp)(nil), // 23: proto.Config.StructResp - (*Config_FieldDocumentation)(nil), // 24: proto.Config.FieldDocumentation - (*Config_MapperDocumentation)(nil), // 25: proto.Config.MapperDocumentation - (*Config_Documentation)(nil), // 26: proto.Config.Documentation - nil, // 27: proto.Config.Documentation.FieldsEntry - (*Auth_AuthResponse)(nil), // 28: proto.Auth.AuthResponse - (*any.Any)(nil), // 29: google.protobuf.Any - (*protostructure.Struct)(nil), // 30: protostructure.Struct -} -var file_plugin_proto_depIdxs = []int32{ - 20, // 0: proto.FuncSpec.args:type_name -> proto.FuncSpec.Value - 20, // 1: proto.FuncSpec.result:type_name -> proto.FuncSpec.Value - 18, // 2: proto.Args.ReleaseTargets.targets:type_name -> proto.Args.ReleaseTargets.Target - 19, // 3: proto.Args.LabelSet.labels:type_name -> proto.Args.LabelSet.LabelsEntry - 29, // 4: proto.Args.ReleaseTargets.Target.deployment:type_name -> google.protobuf.Any - 29, // 5: proto.FuncSpec.Value.value:type_name -> google.protobuf.Any - 20, // 6: proto.FuncSpec.Args.args:type_name -> proto.FuncSpec.Value - 30, // 7: proto.Config.StructResp.struct:type_name -> protostructure.Struct - 27, // 8: proto.Config.Documentation.fields:type_name -> proto.Config.Documentation.FieldsEntry - 25, // 9: proto.Config.Documentation.mappers:type_name -> proto.Config.MapperDocumentation - 24, // 10: proto.Config.Documentation.FieldsEntry.value:type_name -> proto.Config.FieldDocumentation - 11, // [11:11] is the sub-list for method output_type - 11, // [11:11] is the sub-list for method input_type - 11, // [11:11] is the sub-list for extension type_name - 11, // [11:11] is the sub-list for extension extendee - 0, // [0:11] is the sub-list for field type_name -} - -func init() { file_plugin_proto_init() } -func file_plugin_proto_init() { - if File_plugin_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_plugin_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Args); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Empty); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FuncSpec); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Auth); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ImplementsResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Args_Source); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Args_JobInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Args_DeploymentConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Args_DataDir); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Args_Logger); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Args_TerminalUI); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Args_HistoryClient); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Args_ReleaseTargets); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Args_LabelSet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Args_DataDir_Project); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Args_DataDir_App); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Args_DataDir_Component); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Args_ReleaseTargets_Target); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FuncSpec_Value); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FuncSpec_Args); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config_ConfigureRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config_StructResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config_FieldDocumentation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config_MapperDocumentation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config_Documentation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_plugin_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Auth_AuthResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_plugin_proto_rawDesc, - NumEnums: 0, - NumMessages: 29, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_plugin_proto_goTypes, - DependencyIndexes: file_plugin_proto_depIdxs, - MessageInfos: file_plugin_proto_msgTypes, - }.Build() - File_plugin_proto = out.File - file_plugin_proto_rawDesc = nil - file_plugin_proto_goTypes = nil - file_plugin_proto_depIdxs = nil -} diff --git a/sdk/proto/plugin.proto b/sdk/proto/plugin.proto deleted file mode 100644 index c7eab0471ad..00000000000 --- a/sdk/proto/plugin.proto +++ /dev/null @@ -1,210 +0,0 @@ -syntax = "proto3"; - -package proto; - -option go_package = ".;proto"; - -import "google/protobuf/any.proto"; -import "protostructure.proto"; - -// Args are the common argument types that are available to many of the -// dynamic functions. The exact list of available argument types is available -// on the Go interface docs. -message Args { - // See component.Source - message Source { - // app is the name of the application being deployed. - string app = 1; - - // path is the absolute directory path to the root directory for source files. - string path = 2; - } - - // See component.JobInfo - message JobInfo { - bool local = 1; - string workspace = 2; - string id = 3; - } - - // See component.DeploymentConfig - message DeploymentConfig { - string id = 1; - string server_addr = 2; - bool server_tls = 3; - bool server_tls_skip_verify = 4; - string entrypoint_invite_token = 5; - } - - // DataDir represents the directory where data can be stored. This is an internal - // struct and shouldn't be used directly. Use the relevant *datadir implementation - // instead. - message DataDir { - // NOTE(mitchellh): we use specific types here rather than a single type - // with an enum "type" field or something since this maps more cleanly - // to our internal dependency-injection API. - - message Project { - string cache_dir = 2; - string data_dir = 3; - } - - message App { - string cache_dir = 2; - string data_dir = 3; - } - - message Component { - string cache_dir = 2; - string data_dir = 3; - } - } - - // Logger is used to construct an logger for the plugin. - message Logger { - // name is the name of the logger - string name = 1; - } - - // TerminalUI is used to construct the terminal.UI for the plugin. - message TerminalUI { - uint32 stream_id = 1; - } - - // HistoryClient is used to serve the history client for the plugin. - message HistoryClient { - uint32 stream_id = 1; - } - - // ReleaseTargets is the set of targets for a release operation. - message ReleaseTargets { - // The set of targets for a release. This is always guaranteed by - // the caller to sum to 100%. If the release component doesn't support - // traffic splitting, this is guaranteed to always be length 1. - repeated Target targets = 1; - - // Target is a single target for releasing. - message Target { - google.protobuf.Any deployment = 1; - uint32 percent = 2; - } - } - - // LabelSet is a set of labels for anything that can be labelled, such - // as a deployment, build, etc. - message LabelSet { - map labels = 1; - } -} - -// Empty is just an empty message useful with some RPC endpoints. -message Empty {} - -// FuncSpec describes a function and is used by the dependency-injection -// framework to provide the function with the proper values. -// -// Value types are specified using strings. Built-in framework types -// are defined via constants in the `sdk` package. For custom types, you -// can use whatever string as long as it is unique. We recommend using a -// unique prefix plus the Go type name. -message FuncSpec { - // name of the function. This is used for improved logging. - string name = 1; - - // args is the list of arguments by protobuf Any types. - repeated Value args = 2; - - // result are the resulting types that are made available. This is only - // critically important to be set for functions that may chain to other - // functions. It can be set to blank in which case it will not be used. - repeated Value result = 3; - - message Value { - // name is the name of the argument. This may be empty for typed arguments. - string name = 1; - - // type is the type of the argument. All arguments must be encoded using - // *any.Any so this type specifies the proto Any message type and not - // a language-specific type. - string type = 2; - - // value is the value for this Value. This is only expected to be set - // for Args and has no impact on specs. - google.protobuf.Any value = 3; - } - - // Args is the standard argument type for an RPC that is calling a FuncSpec. - message Args { - // args is the list of arguments. This will include some of the - // standard types in this file (in the Args message namespace) as well - // as custom types declared by the FuncSpec that the plugin is expected - // to understand how to decode. - repeated Value args = 1; - } -} - -// Config is the namespace of messages related to configuration. -// -// All components that take configuration are expected to have two RPC calls: -// -// * ConfigStruct - Returns the configuration structure. -// * Configure - Sends the configuration data back to the plugin and the -// plugin is also expected to perform any validation at this stage. -// * Documentation - Returns a Documentation struct that details what configuration -// is accepted, with documentation. -// -message Config { - // ConfigureRequest is the request sent once the configuration decoding - // is complete to actually assign the values to the structure. - message ConfigureRequest { - // json is the json data for the structure returned in the StructResp. - // It is guaranteed to decode cleanly into the target structure. - bytes json = 1; - } - - // StructResp returns the struct for configuration. - message StructResp { - // struct is the configuration structure (or empty/nil if one doesn't exist). - // This struct should have all the proper struct tags for HCL decoding - // You should do validation on the Configure call. - protostructure.Struct struct = 1; - } - - message FieldDocumentation { - string name = 1; - string synopsis = 2; - string summary = 3; - bool optional = 4; - string env_var = 5; - string type = 6; - string default = 7; - } - - message MapperDocumentation { - string input = 1; - string output = 2; - string description = 3; - } - - message Documentation { - string description = 1; - string example = 2; - string input = 3; - string output = 4; - map fields = 5; - repeated MapperDocumentation mappers = 6; - } -} - -// Auth is the namespace of messages related to auth. -message Auth { - // AuthResponse is returned by the Auth functions. - message AuthResponse { - bool authenticated = 1; - } -} - -// ImplementsResp returns true if the component implements an additional interface. -message ImplementsResp { - bool implements = 1; -} diff --git a/sdk/proto/registry.pb.go b/sdk/proto/registry.pb.go deleted file mode 100644 index eac92ae8398..00000000000 --- a/sdk/proto/registry.pb.go +++ /dev/null @@ -1,684 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v3.11.2 -// source: registry.proto - -package proto - -import ( - context "context" - proto "github.com/golang/protobuf/proto" - any "github.com/golang/protobuf/ptypes/any" - empty "github.com/golang/protobuf/ptypes/empty" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type Push struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *Push) Reset() { - *x = Push{} - if protoimpl.UnsafeEnabled { - mi := &file_registry_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Push) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Push) ProtoMessage() {} - -func (x *Push) ProtoReflect() protoreflect.Message { - mi := &file_registry_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Push.ProtoReflect.Descriptor instead. -func (*Push) Descriptor() ([]byte, []int) { - return file_registry_proto_rawDescGZIP(), []int{0} -} - -type Push_Resp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // result is the resulting opaque data type - Result *any.Any `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` -} - -func (x *Push_Resp) Reset() { - *x = Push_Resp{} - if protoimpl.UnsafeEnabled { - mi := &file_registry_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Push_Resp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Push_Resp) ProtoMessage() {} - -func (x *Push_Resp) ProtoReflect() protoreflect.Message { - mi := &file_registry_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Push_Resp.ProtoReflect.Descriptor instead. -func (*Push_Resp) Descriptor() ([]byte, []int) { - return file_registry_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *Push_Resp) GetResult() *any.Any { - if x != nil { - return x.Result - } - return nil -} - -var File_registry_proto protoreflect.FileDescriptor - -var file_registry_proto_rawDesc = []byte{ - 0x0a, 0x0e, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x0c, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3c, 0x0a, - 0x04, 0x50, 0x75, 0x73, 0x68, 0x1a, 0x34, 0x0a, 0x04, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2c, 0x0a, - 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x41, 0x6e, 0x79, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x32, 0xdc, 0x04, 0x0a, 0x08, - 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x12, 0x40, 0x0a, 0x0f, 0x49, 0x73, 0x41, 0x75, - 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6d, 0x70, 0x6c, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x36, 0x0a, 0x04, 0x41, 0x75, - 0x74, 0x68, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, - 0x70, 0x65, 0x63, 0x2e, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x41, 0x75, 0x74, 0x68, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x41, 0x75, 0x74, 0x68, 0x53, 0x70, 0x65, 0x63, 0x12, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, - 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x12, 0x3c, 0x0a, 0x0c, 0x56, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x3b, 0x0a, 0x10, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, - 0x65, 0x41, 0x75, 0x74, 0x68, 0x53, 0x70, 0x65, 0x63, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, - 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, - 0x65, 0x63, 0x12, 0x40, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x53, 0x74, 0x72, 0x75, - 0x63, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x18, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x12, 0x43, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, - 0x65, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x44, 0x0a, 0x0d, 0x44, 0x6f, 0x63, - 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x29, 0x0a, 0x08, 0x50, 0x75, 0x73, 0x68, 0x53, 0x70, 0x65, 0x63, 0x12, 0x0c, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x12, 0x2e, 0x0a, 0x04, 0x50, 0x75, - 0x73, 0x68, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, - 0x70, 0x65, 0x63, 0x2e, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x50, 0x75, 0x73, 0x68, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_registry_proto_rawDescOnce sync.Once - file_registry_proto_rawDescData = file_registry_proto_rawDesc -) - -func file_registry_proto_rawDescGZIP() []byte { - file_registry_proto_rawDescOnce.Do(func() { - file_registry_proto_rawDescData = protoimpl.X.CompressGZIP(file_registry_proto_rawDescData) - }) - return file_registry_proto_rawDescData -} - -var file_registry_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_registry_proto_goTypes = []interface{}{ - (*Push)(nil), // 0: proto.Push - (*Push_Resp)(nil), // 1: proto.Push.Resp - (*any.Any)(nil), // 2: google.protobuf.Any - (*empty.Empty)(nil), // 3: google.protobuf.Empty - (*FuncSpec_Args)(nil), // 4: proto.FuncSpec.Args - (*Config_ConfigureRequest)(nil), // 5: proto.Config.ConfigureRequest - (*Empty)(nil), // 6: proto.Empty - (*ImplementsResp)(nil), // 7: proto.ImplementsResp - (*Auth_AuthResponse)(nil), // 8: proto.Auth.AuthResponse - (*FuncSpec)(nil), // 9: proto.FuncSpec - (*Config_StructResp)(nil), // 10: proto.Config.StructResp - (*Config_Documentation)(nil), // 11: proto.Config.Documentation -} -var file_registry_proto_depIdxs = []int32{ - 2, // 0: proto.Push.Resp.result:type_name -> google.protobuf.Any - 3, // 1: proto.Registry.IsAuthenticator:input_type -> google.protobuf.Empty - 4, // 2: proto.Registry.Auth:input_type -> proto.FuncSpec.Args - 3, // 3: proto.Registry.AuthSpec:input_type -> google.protobuf.Empty - 4, // 4: proto.Registry.ValidateAuth:input_type -> proto.FuncSpec.Args - 3, // 5: proto.Registry.ValidateAuthSpec:input_type -> google.protobuf.Empty - 3, // 6: proto.Registry.ConfigStruct:input_type -> google.protobuf.Empty - 5, // 7: proto.Registry.Configure:input_type -> proto.Config.ConfigureRequest - 3, // 8: proto.Registry.Documentation:input_type -> google.protobuf.Empty - 6, // 9: proto.Registry.PushSpec:input_type -> proto.Empty - 4, // 10: proto.Registry.Push:input_type -> proto.FuncSpec.Args - 7, // 11: proto.Registry.IsAuthenticator:output_type -> proto.ImplementsResp - 8, // 12: proto.Registry.Auth:output_type -> proto.Auth.AuthResponse - 9, // 13: proto.Registry.AuthSpec:output_type -> proto.FuncSpec - 3, // 14: proto.Registry.ValidateAuth:output_type -> google.protobuf.Empty - 9, // 15: proto.Registry.ValidateAuthSpec:output_type -> proto.FuncSpec - 10, // 16: proto.Registry.ConfigStruct:output_type -> proto.Config.StructResp - 3, // 17: proto.Registry.Configure:output_type -> google.protobuf.Empty - 11, // 18: proto.Registry.Documentation:output_type -> proto.Config.Documentation - 9, // 19: proto.Registry.PushSpec:output_type -> proto.FuncSpec - 1, // 20: proto.Registry.Push:output_type -> proto.Push.Resp - 11, // [11:21] is the sub-list for method output_type - 1, // [1:11] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_registry_proto_init() } -func file_registry_proto_init() { - if File_registry_proto != nil { - return - } - file_plugin_proto_init() - if !protoimpl.UnsafeEnabled { - file_registry_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Push); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_registry_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Push_Resp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_registry_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_registry_proto_goTypes, - DependencyIndexes: file_registry_proto_depIdxs, - MessageInfos: file_registry_proto_msgTypes, - }.Build() - File_registry_proto = out.File - file_registry_proto_rawDesc = nil - file_registry_proto_goTypes = nil - file_registry_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// RegistryClient is the client API for Registry service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type RegistryClient interface { - IsAuthenticator(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImplementsResp, error) - Auth(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*Auth_AuthResponse, error) - AuthSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) - ValidateAuth(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*empty.Empty, error) - ValidateAuthSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) - ConfigStruct(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Config_StructResp, error) - Configure(ctx context.Context, in *Config_ConfigureRequest, opts ...grpc.CallOption) (*empty.Empty, error) - Documentation(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Config_Documentation, error) - PushSpec(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*FuncSpec, error) - Push(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*Push_Resp, error) -} - -type registryClient struct { - cc grpc.ClientConnInterface -} - -func NewRegistryClient(cc grpc.ClientConnInterface) RegistryClient { - return ®istryClient{cc} -} - -func (c *registryClient) IsAuthenticator(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImplementsResp, error) { - out := new(ImplementsResp) - err := c.cc.Invoke(ctx, "/proto.Registry/IsAuthenticator", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *registryClient) Auth(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*Auth_AuthResponse, error) { - out := new(Auth_AuthResponse) - err := c.cc.Invoke(ctx, "/proto.Registry/Auth", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *registryClient) AuthSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) { - out := new(FuncSpec) - err := c.cc.Invoke(ctx, "/proto.Registry/AuthSpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *registryClient) ValidateAuth(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/proto.Registry/ValidateAuth", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *registryClient) ValidateAuthSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) { - out := new(FuncSpec) - err := c.cc.Invoke(ctx, "/proto.Registry/ValidateAuthSpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *registryClient) ConfigStruct(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Config_StructResp, error) { - out := new(Config_StructResp) - err := c.cc.Invoke(ctx, "/proto.Registry/ConfigStruct", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *registryClient) Configure(ctx context.Context, in *Config_ConfigureRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/proto.Registry/Configure", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *registryClient) Documentation(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Config_Documentation, error) { - out := new(Config_Documentation) - err := c.cc.Invoke(ctx, "/proto.Registry/Documentation", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *registryClient) PushSpec(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*FuncSpec, error) { - out := new(FuncSpec) - err := c.cc.Invoke(ctx, "/proto.Registry/PushSpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *registryClient) Push(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*Push_Resp, error) { - out := new(Push_Resp) - err := c.cc.Invoke(ctx, "/proto.Registry/Push", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// RegistryServer is the server API for Registry service. -type RegistryServer interface { - IsAuthenticator(context.Context, *empty.Empty) (*ImplementsResp, error) - Auth(context.Context, *FuncSpec_Args) (*Auth_AuthResponse, error) - AuthSpec(context.Context, *empty.Empty) (*FuncSpec, error) - ValidateAuth(context.Context, *FuncSpec_Args) (*empty.Empty, error) - ValidateAuthSpec(context.Context, *empty.Empty) (*FuncSpec, error) - ConfigStruct(context.Context, *empty.Empty) (*Config_StructResp, error) - Configure(context.Context, *Config_ConfigureRequest) (*empty.Empty, error) - Documentation(context.Context, *empty.Empty) (*Config_Documentation, error) - PushSpec(context.Context, *Empty) (*FuncSpec, error) - Push(context.Context, *FuncSpec_Args) (*Push_Resp, error) -} - -// UnimplementedRegistryServer can be embedded to have forward compatible implementations. -type UnimplementedRegistryServer struct { -} - -func (*UnimplementedRegistryServer) IsAuthenticator(context.Context, *empty.Empty) (*ImplementsResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method IsAuthenticator not implemented") -} -func (*UnimplementedRegistryServer) Auth(context.Context, *FuncSpec_Args) (*Auth_AuthResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Auth not implemented") -} -func (*UnimplementedRegistryServer) AuthSpec(context.Context, *empty.Empty) (*FuncSpec, error) { - return nil, status.Errorf(codes.Unimplemented, "method AuthSpec not implemented") -} -func (*UnimplementedRegistryServer) ValidateAuth(context.Context, *FuncSpec_Args) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateAuth not implemented") -} -func (*UnimplementedRegistryServer) ValidateAuthSpec(context.Context, *empty.Empty) (*FuncSpec, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateAuthSpec not implemented") -} -func (*UnimplementedRegistryServer) ConfigStruct(context.Context, *empty.Empty) (*Config_StructResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method ConfigStruct not implemented") -} -func (*UnimplementedRegistryServer) Configure(context.Context, *Config_ConfigureRequest) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method Configure not implemented") -} -func (*UnimplementedRegistryServer) Documentation(context.Context, *empty.Empty) (*Config_Documentation, error) { - return nil, status.Errorf(codes.Unimplemented, "method Documentation not implemented") -} -func (*UnimplementedRegistryServer) PushSpec(context.Context, *Empty) (*FuncSpec, error) { - return nil, status.Errorf(codes.Unimplemented, "method PushSpec not implemented") -} -func (*UnimplementedRegistryServer) Push(context.Context, *FuncSpec_Args) (*Push_Resp, error) { - return nil, status.Errorf(codes.Unimplemented, "method Push not implemented") -} - -func RegisterRegistryServer(s *grpc.Server, srv RegistryServer) { - s.RegisterService(&_Registry_serviceDesc, srv) -} - -func _Registry_IsAuthenticator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RegistryServer).IsAuthenticator(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Registry/IsAuthenticator", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RegistryServer).IsAuthenticator(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Registry_Auth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FuncSpec_Args) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RegistryServer).Auth(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Registry/Auth", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RegistryServer).Auth(ctx, req.(*FuncSpec_Args)) - } - return interceptor(ctx, in, info, handler) -} - -func _Registry_AuthSpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RegistryServer).AuthSpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Registry/AuthSpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RegistryServer).AuthSpec(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Registry_ValidateAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FuncSpec_Args) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RegistryServer).ValidateAuth(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Registry/ValidateAuth", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RegistryServer).ValidateAuth(ctx, req.(*FuncSpec_Args)) - } - return interceptor(ctx, in, info, handler) -} - -func _Registry_ValidateAuthSpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RegistryServer).ValidateAuthSpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Registry/ValidateAuthSpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RegistryServer).ValidateAuthSpec(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Registry_ConfigStruct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RegistryServer).ConfigStruct(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Registry/ConfigStruct", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RegistryServer).ConfigStruct(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Registry_Configure_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Config_ConfigureRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RegistryServer).Configure(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Registry/Configure", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RegistryServer).Configure(ctx, req.(*Config_ConfigureRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Registry_Documentation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RegistryServer).Documentation(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Registry/Documentation", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RegistryServer).Documentation(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Registry_PushSpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RegistryServer).PushSpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Registry/PushSpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RegistryServer).PushSpec(ctx, req.(*Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _Registry_Push_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FuncSpec_Args) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(RegistryServer).Push(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.Registry/Push", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(RegistryServer).Push(ctx, req.(*FuncSpec_Args)) - } - return interceptor(ctx, in, info, handler) -} - -var _Registry_serviceDesc = grpc.ServiceDesc{ - ServiceName: "proto.Registry", - HandlerType: (*RegistryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "IsAuthenticator", - Handler: _Registry_IsAuthenticator_Handler, - }, - { - MethodName: "Auth", - Handler: _Registry_Auth_Handler, - }, - { - MethodName: "AuthSpec", - Handler: _Registry_AuthSpec_Handler, - }, - { - MethodName: "ValidateAuth", - Handler: _Registry_ValidateAuth_Handler, - }, - { - MethodName: "ValidateAuthSpec", - Handler: _Registry_ValidateAuthSpec_Handler, - }, - { - MethodName: "ConfigStruct", - Handler: _Registry_ConfigStruct_Handler, - }, - { - MethodName: "Configure", - Handler: _Registry_Configure_Handler, - }, - { - MethodName: "Documentation", - Handler: _Registry_Documentation_Handler, - }, - { - MethodName: "PushSpec", - Handler: _Registry_PushSpec_Handler, - }, - { - MethodName: "Push", - Handler: _Registry_Push_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "registry.proto", -} diff --git a/sdk/proto/registry.proto b/sdk/proto/registry.proto deleted file mode 100644 index b4c392e97a7..00000000000 --- a/sdk/proto/registry.proto +++ /dev/null @@ -1,35 +0,0 @@ -syntax = "proto3"; - -package proto; - -option go_package = ".;proto"; - -import "google/protobuf/any.proto"; -import "google/protobuf/empty.proto"; -import "plugin.proto"; - -// Registry is responsible for pushing a built artifact to some registry. -// The difference between a registry and a builder is that while a builder -// produces an artifact from source, a registry provides operations to work -// with artifacts such as listing previous, deleting, etc. -service Registry { - rpc IsAuthenticator(google.protobuf.Empty) returns (ImplementsResp); - rpc Auth(FuncSpec.Args) returns (Auth.AuthResponse); - rpc AuthSpec(google.protobuf.Empty) returns (FuncSpec); - rpc ValidateAuth(FuncSpec.Args) returns (google.protobuf.Empty); - rpc ValidateAuthSpec(google.protobuf.Empty) returns (FuncSpec); - - rpc ConfigStruct(google.protobuf.Empty) returns (Config.StructResp); - rpc Configure(Config.ConfigureRequest) returns (google.protobuf.Empty); - rpc Documentation(google.protobuf.Empty) returns (Config.Documentation); - - rpc PushSpec(Empty) returns (FuncSpec); - rpc Push(FuncSpec.Args) returns (Push.Resp); -} - -message Push { - message Resp { - // result is the resulting opaque data type - google.protobuf.Any result = 1; - } -} diff --git a/sdk/proto/release.pb.go b/sdk/proto/release.pb.go deleted file mode 100644 index dc449d2421b..00000000000 --- a/sdk/proto/release.pb.go +++ /dev/null @@ -1,964 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v3.11.2 -// source: release.proto - -package proto - -import ( - context "context" - proto "github.com/golang/protobuf/proto" - any "github.com/golang/protobuf/ptypes/any" - empty "github.com/golang/protobuf/ptypes/empty" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type Release struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` -} - -func (x *Release) Reset() { - *x = Release{} - if protoimpl.UnsafeEnabled { - mi := &file_release_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Release) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Release) ProtoMessage() {} - -func (x *Release) ProtoReflect() protoreflect.Message { - mi := &file_release_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Release.ProtoReflect.Descriptor instead. -func (*Release) Descriptor() ([]byte, []int) { - return file_release_proto_rawDescGZIP(), []int{0} -} - -func (x *Release) GetUrl() string { - if x != nil { - return x.Url - } - return "" -} - -type Release_Resp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // result is the resulting data type for building. - Result *any.Any `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` - // release structure - Release *Release `protobuf:"bytes,2,opt,name=release,proto3" json:"release,omitempty"` -} - -func (x *Release_Resp) Reset() { - *x = Release_Resp{} - if protoimpl.UnsafeEnabled { - mi := &file_release_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Release_Resp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Release_Resp) ProtoMessage() {} - -func (x *Release_Resp) ProtoReflect() protoreflect.Message { - mi := &file_release_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Release_Resp.ProtoReflect.Descriptor instead. -func (*Release_Resp) Descriptor() ([]byte, []int) { - return file_release_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *Release_Resp) GetResult() *any.Any { - if x != nil { - return x.Result - } - return nil -} - -func (x *Release_Resp) GetRelease() *Release { - if x != nil { - return x.Release - } - return nil -} - -var File_release_proto protoreflect.FileDescriptor - -var file_release_proto_rawDesc = []byte{ - 0x0a, 0x0d, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0c, - 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7b, 0x0a, 0x07, - 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x1a, 0x5e, 0x0a, 0x04, 0x52, 0x65, 0x73, - 0x70, 0x12, 0x2c, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, - 0x28, 0x0a, 0x07, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, - 0x52, 0x07, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x32, 0xe4, 0x07, 0x0a, 0x0e, 0x52, 0x65, - 0x6c, 0x65, 0x61, 0x73, 0x65, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x12, 0x40, 0x0a, 0x0f, - 0x49, 0x73, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x6f, 0x72, 0x12, - 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x49, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x36, - 0x0a, 0x04, 0x41, 0x75, 0x74, 0x68, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, - 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x18, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x41, 0x75, 0x74, 0x68, 0x53, 0x70, - 0x65, 0x63, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x12, 0x3c, 0x0a, 0x0c, 0x56, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x12, 0x14, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x41, 0x72, 0x67, - 0x73, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x3b, 0x0a, 0x10, 0x56, 0x61, 0x6c, - 0x69, 0x64, 0x61, 0x74, 0x65, 0x41, 0x75, 0x74, 0x68, 0x53, 0x70, 0x65, 0x63, 0x12, 0x16, 0x2e, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, - 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, - 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x12, 0x40, 0x0a, 0x0c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x18, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x53, 0x74, - 0x72, 0x75, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x43, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x75, 0x72, 0x65, 0x12, 0x1e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x44, 0x0a, - 0x0d, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x3c, 0x0a, 0x0b, 0x49, 0x73, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, - 0x65, 0x72, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x49, 0x6d, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x12, 0x36, 0x0a, 0x0b, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x53, 0x70, 0x65, 0x63, - 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x12, 0x37, 0x0a, 0x07, 0x44, 0x65, 0x73, - 0x74, 0x72, 0x6f, 0x79, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, - 0x63, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x12, 0x45, 0x0a, 0x14, 0x49, 0x73, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, - 0x65, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x65, 0x72, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x49, 0x6d, 0x70, 0x6c, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x3f, 0x0a, 0x14, 0x44, 0x65, 0x73, - 0x74, 0x72, 0x6f, 0x79, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x53, 0x70, 0x65, - 0x63, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x12, 0x40, 0x0a, 0x10, 0x44, 0x65, - 0x73, 0x74, 0x72, 0x6f, 0x79, 0x57, 0x6f, 0x72, 0x6b, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x14, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x2e, - 0x41, 0x72, 0x67, 0x73, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x2c, 0x0a, 0x0b, - 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x70, 0x65, 0x63, 0x12, 0x0c, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x12, 0x34, 0x0a, 0x07, 0x52, 0x65, - 0x6c, 0x65, 0x61, 0x73, 0x65, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x75, - 0x6e, 0x63, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x41, 0x72, 0x67, 0x73, 0x1a, 0x13, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, - 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_release_proto_rawDescOnce sync.Once - file_release_proto_rawDescData = file_release_proto_rawDesc -) - -func file_release_proto_rawDescGZIP() []byte { - file_release_proto_rawDescOnce.Do(func() { - file_release_proto_rawDescData = protoimpl.X.CompressGZIP(file_release_proto_rawDescData) - }) - return file_release_proto_rawDescData -} - -var file_release_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_release_proto_goTypes = []interface{}{ - (*Release)(nil), // 0: proto.Release - (*Release_Resp)(nil), // 1: proto.Release.Resp - (*any.Any)(nil), // 2: google.protobuf.Any - (*empty.Empty)(nil), // 3: google.protobuf.Empty - (*FuncSpec_Args)(nil), // 4: proto.FuncSpec.Args - (*Config_ConfigureRequest)(nil), // 5: proto.Config.ConfigureRequest - (*Empty)(nil), // 6: proto.Empty - (*ImplementsResp)(nil), // 7: proto.ImplementsResp - (*Auth_AuthResponse)(nil), // 8: proto.Auth.AuthResponse - (*FuncSpec)(nil), // 9: proto.FuncSpec - (*Config_StructResp)(nil), // 10: proto.Config.StructResp - (*Config_Documentation)(nil), // 11: proto.Config.Documentation -} -var file_release_proto_depIdxs = []int32{ - 2, // 0: proto.Release.Resp.result:type_name -> google.protobuf.Any - 0, // 1: proto.Release.Resp.release:type_name -> proto.Release - 3, // 2: proto.ReleaseManager.IsAuthenticator:input_type -> google.protobuf.Empty - 4, // 3: proto.ReleaseManager.Auth:input_type -> proto.FuncSpec.Args - 3, // 4: proto.ReleaseManager.AuthSpec:input_type -> google.protobuf.Empty - 4, // 5: proto.ReleaseManager.ValidateAuth:input_type -> proto.FuncSpec.Args - 3, // 6: proto.ReleaseManager.ValidateAuthSpec:input_type -> google.protobuf.Empty - 3, // 7: proto.ReleaseManager.ConfigStruct:input_type -> google.protobuf.Empty - 5, // 8: proto.ReleaseManager.Configure:input_type -> proto.Config.ConfigureRequest - 3, // 9: proto.ReleaseManager.Documentation:input_type -> google.protobuf.Empty - 3, // 10: proto.ReleaseManager.IsDestroyer:input_type -> google.protobuf.Empty - 3, // 11: proto.ReleaseManager.DestroySpec:input_type -> google.protobuf.Empty - 4, // 12: proto.ReleaseManager.Destroy:input_type -> proto.FuncSpec.Args - 3, // 13: proto.ReleaseManager.IsWorkspaceDestroyer:input_type -> google.protobuf.Empty - 3, // 14: proto.ReleaseManager.DestroyWorkspaceSpec:input_type -> google.protobuf.Empty - 4, // 15: proto.ReleaseManager.DestroyWorkspace:input_type -> proto.FuncSpec.Args - 6, // 16: proto.ReleaseManager.ReleaseSpec:input_type -> proto.Empty - 4, // 17: proto.ReleaseManager.Release:input_type -> proto.FuncSpec.Args - 7, // 18: proto.ReleaseManager.IsAuthenticator:output_type -> proto.ImplementsResp - 8, // 19: proto.ReleaseManager.Auth:output_type -> proto.Auth.AuthResponse - 9, // 20: proto.ReleaseManager.AuthSpec:output_type -> proto.FuncSpec - 3, // 21: proto.ReleaseManager.ValidateAuth:output_type -> google.protobuf.Empty - 9, // 22: proto.ReleaseManager.ValidateAuthSpec:output_type -> proto.FuncSpec - 10, // 23: proto.ReleaseManager.ConfigStruct:output_type -> proto.Config.StructResp - 3, // 24: proto.ReleaseManager.Configure:output_type -> google.protobuf.Empty - 11, // 25: proto.ReleaseManager.Documentation:output_type -> proto.Config.Documentation - 7, // 26: proto.ReleaseManager.IsDestroyer:output_type -> proto.ImplementsResp - 9, // 27: proto.ReleaseManager.DestroySpec:output_type -> proto.FuncSpec - 3, // 28: proto.ReleaseManager.Destroy:output_type -> google.protobuf.Empty - 7, // 29: proto.ReleaseManager.IsWorkspaceDestroyer:output_type -> proto.ImplementsResp - 9, // 30: proto.ReleaseManager.DestroyWorkspaceSpec:output_type -> proto.FuncSpec - 3, // 31: proto.ReleaseManager.DestroyWorkspace:output_type -> google.protobuf.Empty - 9, // 32: proto.ReleaseManager.ReleaseSpec:output_type -> proto.FuncSpec - 1, // 33: proto.ReleaseManager.Release:output_type -> proto.Release.Resp - 18, // [18:34] is the sub-list for method output_type - 2, // [2:18] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_release_proto_init() } -func file_release_proto_init() { - if File_release_proto != nil { - return - } - file_plugin_proto_init() - if !protoimpl.UnsafeEnabled { - file_release_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Release); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_release_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Release_Resp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_release_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_release_proto_goTypes, - DependencyIndexes: file_release_proto_depIdxs, - MessageInfos: file_release_proto_msgTypes, - }.Build() - File_release_proto = out.File - file_release_proto_rawDesc = nil - file_release_proto_goTypes = nil - file_release_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// ReleaseManagerClient is the client API for ReleaseManager service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type ReleaseManagerClient interface { - IsAuthenticator(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImplementsResp, error) - Auth(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*Auth_AuthResponse, error) - AuthSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) - ValidateAuth(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*empty.Empty, error) - ValidateAuthSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) - ConfigStruct(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Config_StructResp, error) - Configure(ctx context.Context, in *Config_ConfigureRequest, opts ...grpc.CallOption) (*empty.Empty, error) - Documentation(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Config_Documentation, error) - // component.Destroyer optional implementation - IsDestroyer(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImplementsResp, error) - DestroySpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) - Destroy(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*empty.Empty, error) - // component.WorkspaceDestroyer optional implementation - IsWorkspaceDestroyer(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImplementsResp, error) - DestroyWorkspaceSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) - DestroyWorkspace(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*empty.Empty, error) - ReleaseSpec(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*FuncSpec, error) - Release(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*Release_Resp, error) -} - -type releaseManagerClient struct { - cc grpc.ClientConnInterface -} - -func NewReleaseManagerClient(cc grpc.ClientConnInterface) ReleaseManagerClient { - return &releaseManagerClient{cc} -} - -func (c *releaseManagerClient) IsAuthenticator(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImplementsResp, error) { - out := new(ImplementsResp) - err := c.cc.Invoke(ctx, "/proto.ReleaseManager/IsAuthenticator", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *releaseManagerClient) Auth(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*Auth_AuthResponse, error) { - out := new(Auth_AuthResponse) - err := c.cc.Invoke(ctx, "/proto.ReleaseManager/Auth", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *releaseManagerClient) AuthSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) { - out := new(FuncSpec) - err := c.cc.Invoke(ctx, "/proto.ReleaseManager/AuthSpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *releaseManagerClient) ValidateAuth(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/proto.ReleaseManager/ValidateAuth", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *releaseManagerClient) ValidateAuthSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) { - out := new(FuncSpec) - err := c.cc.Invoke(ctx, "/proto.ReleaseManager/ValidateAuthSpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *releaseManagerClient) ConfigStruct(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Config_StructResp, error) { - out := new(Config_StructResp) - err := c.cc.Invoke(ctx, "/proto.ReleaseManager/ConfigStruct", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *releaseManagerClient) Configure(ctx context.Context, in *Config_ConfigureRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/proto.ReleaseManager/Configure", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *releaseManagerClient) Documentation(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Config_Documentation, error) { - out := new(Config_Documentation) - err := c.cc.Invoke(ctx, "/proto.ReleaseManager/Documentation", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *releaseManagerClient) IsDestroyer(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImplementsResp, error) { - out := new(ImplementsResp) - err := c.cc.Invoke(ctx, "/proto.ReleaseManager/IsDestroyer", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *releaseManagerClient) DestroySpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) { - out := new(FuncSpec) - err := c.cc.Invoke(ctx, "/proto.ReleaseManager/DestroySpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *releaseManagerClient) Destroy(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/proto.ReleaseManager/Destroy", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *releaseManagerClient) IsWorkspaceDestroyer(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*ImplementsResp, error) { - out := new(ImplementsResp) - err := c.cc.Invoke(ctx, "/proto.ReleaseManager/IsWorkspaceDestroyer", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *releaseManagerClient) DestroyWorkspaceSpec(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*FuncSpec, error) { - out := new(FuncSpec) - err := c.cc.Invoke(ctx, "/proto.ReleaseManager/DestroyWorkspaceSpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *releaseManagerClient) DestroyWorkspace(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/proto.ReleaseManager/DestroyWorkspace", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *releaseManagerClient) ReleaseSpec(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*FuncSpec, error) { - out := new(FuncSpec) - err := c.cc.Invoke(ctx, "/proto.ReleaseManager/ReleaseSpec", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *releaseManagerClient) Release(ctx context.Context, in *FuncSpec_Args, opts ...grpc.CallOption) (*Release_Resp, error) { - out := new(Release_Resp) - err := c.cc.Invoke(ctx, "/proto.ReleaseManager/Release", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ReleaseManagerServer is the server API for ReleaseManager service. -type ReleaseManagerServer interface { - IsAuthenticator(context.Context, *empty.Empty) (*ImplementsResp, error) - Auth(context.Context, *FuncSpec_Args) (*Auth_AuthResponse, error) - AuthSpec(context.Context, *empty.Empty) (*FuncSpec, error) - ValidateAuth(context.Context, *FuncSpec_Args) (*empty.Empty, error) - ValidateAuthSpec(context.Context, *empty.Empty) (*FuncSpec, error) - ConfigStruct(context.Context, *empty.Empty) (*Config_StructResp, error) - Configure(context.Context, *Config_ConfigureRequest) (*empty.Empty, error) - Documentation(context.Context, *empty.Empty) (*Config_Documentation, error) - // component.Destroyer optional implementation - IsDestroyer(context.Context, *empty.Empty) (*ImplementsResp, error) - DestroySpec(context.Context, *empty.Empty) (*FuncSpec, error) - Destroy(context.Context, *FuncSpec_Args) (*empty.Empty, error) - // component.WorkspaceDestroyer optional implementation - IsWorkspaceDestroyer(context.Context, *empty.Empty) (*ImplementsResp, error) - DestroyWorkspaceSpec(context.Context, *empty.Empty) (*FuncSpec, error) - DestroyWorkspace(context.Context, *FuncSpec_Args) (*empty.Empty, error) - ReleaseSpec(context.Context, *Empty) (*FuncSpec, error) - Release(context.Context, *FuncSpec_Args) (*Release_Resp, error) -} - -// UnimplementedReleaseManagerServer can be embedded to have forward compatible implementations. -type UnimplementedReleaseManagerServer struct { -} - -func (*UnimplementedReleaseManagerServer) IsAuthenticator(context.Context, *empty.Empty) (*ImplementsResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method IsAuthenticator not implemented") -} -func (*UnimplementedReleaseManagerServer) Auth(context.Context, *FuncSpec_Args) (*Auth_AuthResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Auth not implemented") -} -func (*UnimplementedReleaseManagerServer) AuthSpec(context.Context, *empty.Empty) (*FuncSpec, error) { - return nil, status.Errorf(codes.Unimplemented, "method AuthSpec not implemented") -} -func (*UnimplementedReleaseManagerServer) ValidateAuth(context.Context, *FuncSpec_Args) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateAuth not implemented") -} -func (*UnimplementedReleaseManagerServer) ValidateAuthSpec(context.Context, *empty.Empty) (*FuncSpec, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateAuthSpec not implemented") -} -func (*UnimplementedReleaseManagerServer) ConfigStruct(context.Context, *empty.Empty) (*Config_StructResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method ConfigStruct not implemented") -} -func (*UnimplementedReleaseManagerServer) Configure(context.Context, *Config_ConfigureRequest) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method Configure not implemented") -} -func (*UnimplementedReleaseManagerServer) Documentation(context.Context, *empty.Empty) (*Config_Documentation, error) { - return nil, status.Errorf(codes.Unimplemented, "method Documentation not implemented") -} -func (*UnimplementedReleaseManagerServer) IsDestroyer(context.Context, *empty.Empty) (*ImplementsResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method IsDestroyer not implemented") -} -func (*UnimplementedReleaseManagerServer) DestroySpec(context.Context, *empty.Empty) (*FuncSpec, error) { - return nil, status.Errorf(codes.Unimplemented, "method DestroySpec not implemented") -} -func (*UnimplementedReleaseManagerServer) Destroy(context.Context, *FuncSpec_Args) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method Destroy not implemented") -} -func (*UnimplementedReleaseManagerServer) IsWorkspaceDestroyer(context.Context, *empty.Empty) (*ImplementsResp, error) { - return nil, status.Errorf(codes.Unimplemented, "method IsWorkspaceDestroyer not implemented") -} -func (*UnimplementedReleaseManagerServer) DestroyWorkspaceSpec(context.Context, *empty.Empty) (*FuncSpec, error) { - return nil, status.Errorf(codes.Unimplemented, "method DestroyWorkspaceSpec not implemented") -} -func (*UnimplementedReleaseManagerServer) DestroyWorkspace(context.Context, *FuncSpec_Args) (*empty.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method DestroyWorkspace not implemented") -} -func (*UnimplementedReleaseManagerServer) ReleaseSpec(context.Context, *Empty) (*FuncSpec, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReleaseSpec not implemented") -} -func (*UnimplementedReleaseManagerServer) Release(context.Context, *FuncSpec_Args) (*Release_Resp, error) { - return nil, status.Errorf(codes.Unimplemented, "method Release not implemented") -} - -func RegisterReleaseManagerServer(s *grpc.Server, srv ReleaseManagerServer) { - s.RegisterService(&_ReleaseManager_serviceDesc, srv) -} - -func _ReleaseManager_IsAuthenticator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReleaseManagerServer).IsAuthenticator(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.ReleaseManager/IsAuthenticator", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReleaseManagerServer).IsAuthenticator(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _ReleaseManager_Auth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FuncSpec_Args) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReleaseManagerServer).Auth(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.ReleaseManager/Auth", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReleaseManagerServer).Auth(ctx, req.(*FuncSpec_Args)) - } - return interceptor(ctx, in, info, handler) -} - -func _ReleaseManager_AuthSpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReleaseManagerServer).AuthSpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.ReleaseManager/AuthSpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReleaseManagerServer).AuthSpec(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _ReleaseManager_ValidateAuth_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FuncSpec_Args) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReleaseManagerServer).ValidateAuth(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.ReleaseManager/ValidateAuth", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReleaseManagerServer).ValidateAuth(ctx, req.(*FuncSpec_Args)) - } - return interceptor(ctx, in, info, handler) -} - -func _ReleaseManager_ValidateAuthSpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReleaseManagerServer).ValidateAuthSpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.ReleaseManager/ValidateAuthSpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReleaseManagerServer).ValidateAuthSpec(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _ReleaseManager_ConfigStruct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReleaseManagerServer).ConfigStruct(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.ReleaseManager/ConfigStruct", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReleaseManagerServer).ConfigStruct(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _ReleaseManager_Configure_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Config_ConfigureRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReleaseManagerServer).Configure(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.ReleaseManager/Configure", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReleaseManagerServer).Configure(ctx, req.(*Config_ConfigureRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _ReleaseManager_Documentation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReleaseManagerServer).Documentation(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.ReleaseManager/Documentation", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReleaseManagerServer).Documentation(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _ReleaseManager_IsDestroyer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReleaseManagerServer).IsDestroyer(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.ReleaseManager/IsDestroyer", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReleaseManagerServer).IsDestroyer(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _ReleaseManager_DestroySpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReleaseManagerServer).DestroySpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.ReleaseManager/DestroySpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReleaseManagerServer).DestroySpec(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _ReleaseManager_Destroy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FuncSpec_Args) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReleaseManagerServer).Destroy(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.ReleaseManager/Destroy", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReleaseManagerServer).Destroy(ctx, req.(*FuncSpec_Args)) - } - return interceptor(ctx, in, info, handler) -} - -func _ReleaseManager_IsWorkspaceDestroyer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReleaseManagerServer).IsWorkspaceDestroyer(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.ReleaseManager/IsWorkspaceDestroyer", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReleaseManagerServer).IsWorkspaceDestroyer(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _ReleaseManager_DestroyWorkspaceSpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReleaseManagerServer).DestroyWorkspaceSpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.ReleaseManager/DestroyWorkspaceSpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReleaseManagerServer).DestroyWorkspaceSpec(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _ReleaseManager_DestroyWorkspace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FuncSpec_Args) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReleaseManagerServer).DestroyWorkspace(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.ReleaseManager/DestroyWorkspace", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReleaseManagerServer).DestroyWorkspace(ctx, req.(*FuncSpec_Args)) - } - return interceptor(ctx, in, info, handler) -} - -func _ReleaseManager_ReleaseSpec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReleaseManagerServer).ReleaseSpec(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.ReleaseManager/ReleaseSpec", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReleaseManagerServer).ReleaseSpec(ctx, req.(*Empty)) - } - return interceptor(ctx, in, info, handler) -} - -func _ReleaseManager_Release_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(FuncSpec_Args) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReleaseManagerServer).Release(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.ReleaseManager/Release", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReleaseManagerServer).Release(ctx, req.(*FuncSpec_Args)) - } - return interceptor(ctx, in, info, handler) -} - -var _ReleaseManager_serviceDesc = grpc.ServiceDesc{ - ServiceName: "proto.ReleaseManager", - HandlerType: (*ReleaseManagerServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "IsAuthenticator", - Handler: _ReleaseManager_IsAuthenticator_Handler, - }, - { - MethodName: "Auth", - Handler: _ReleaseManager_Auth_Handler, - }, - { - MethodName: "AuthSpec", - Handler: _ReleaseManager_AuthSpec_Handler, - }, - { - MethodName: "ValidateAuth", - Handler: _ReleaseManager_ValidateAuth_Handler, - }, - { - MethodName: "ValidateAuthSpec", - Handler: _ReleaseManager_ValidateAuthSpec_Handler, - }, - { - MethodName: "ConfigStruct", - Handler: _ReleaseManager_ConfigStruct_Handler, - }, - { - MethodName: "Configure", - Handler: _ReleaseManager_Configure_Handler, - }, - { - MethodName: "Documentation", - Handler: _ReleaseManager_Documentation_Handler, - }, - { - MethodName: "IsDestroyer", - Handler: _ReleaseManager_IsDestroyer_Handler, - }, - { - MethodName: "DestroySpec", - Handler: _ReleaseManager_DestroySpec_Handler, - }, - { - MethodName: "Destroy", - Handler: _ReleaseManager_Destroy_Handler, - }, - { - MethodName: "IsWorkspaceDestroyer", - Handler: _ReleaseManager_IsWorkspaceDestroyer_Handler, - }, - { - MethodName: "DestroyWorkspaceSpec", - Handler: _ReleaseManager_DestroyWorkspaceSpec_Handler, - }, - { - MethodName: "DestroyWorkspace", - Handler: _ReleaseManager_DestroyWorkspace_Handler, - }, - { - MethodName: "ReleaseSpec", - Handler: _ReleaseManager_ReleaseSpec_Handler, - }, - { - MethodName: "Release", - Handler: _ReleaseManager_Release_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "release.proto", -} diff --git a/sdk/proto/release.proto b/sdk/proto/release.proto deleted file mode 100644 index 545cb798854..00000000000 --- a/sdk/proto/release.proto +++ /dev/null @@ -1,48 +0,0 @@ -syntax = "proto3"; - -package proto; - -option go_package = ".;proto"; - -import "google/protobuf/any.proto"; -import "google/protobuf/empty.proto"; -import "plugin.proto"; - -// ReleaseManager is a serivce that handles the process of exposing -// a deployment to traffic. -service ReleaseManager { - rpc IsAuthenticator(google.protobuf.Empty) returns (ImplementsResp); - rpc Auth(FuncSpec.Args) returns (Auth.AuthResponse); - rpc AuthSpec(google.protobuf.Empty) returns (FuncSpec); - rpc ValidateAuth(FuncSpec.Args) returns (google.protobuf.Empty); - rpc ValidateAuthSpec(google.protobuf.Empty) returns (FuncSpec); - - rpc ConfigStruct(google.protobuf.Empty) returns (Config.StructResp); - rpc Configure(Config.ConfigureRequest) returns (google.protobuf.Empty); - rpc Documentation(google.protobuf.Empty) returns (Config.Documentation); - - // component.Destroyer optional implementation - rpc IsDestroyer(google.protobuf.Empty) returns (ImplementsResp); - rpc DestroySpec(google.protobuf.Empty) returns (FuncSpec); - rpc Destroy(FuncSpec.Args) returns (google.protobuf.Empty); - - // component.WorkspaceDestroyer optional implementation - rpc IsWorkspaceDestroyer(google.protobuf.Empty) returns (ImplementsResp); - rpc DestroyWorkspaceSpec(google.protobuf.Empty) returns (FuncSpec); - rpc DestroyWorkspace(FuncSpec.Args) returns (google.protobuf.Empty); - - rpc ReleaseSpec(Empty) returns (FuncSpec); - rpc Release(FuncSpec.Args) returns (Release.Resp); -} - -message Release { - string url = 1; - - message Resp { - // result is the resulting data type for building. - google.protobuf.Any result = 1; - - // release structure - Release release = 2; - } -} diff --git a/sdk/proto/terminal.pb.go b/sdk/proto/terminal.pb.go deleted file mode 100644 index 5f8a9b4ef7d..00000000000 --- a/sdk/proto/terminal.pb.go +++ /dev/null @@ -1,1680 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.23.0 -// protoc v3.11.2 -// source: terminal.proto - -package proto - -import ( - context "context" - proto "github.com/golang/protobuf/proto" - empty "github.com/golang/protobuf/ptypes/empty" - status "google.golang.org/genproto/googleapis/rpc/status" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status1 "google.golang.org/grpc/status" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type TerminalUI struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *TerminalUI) Reset() { - *x = TerminalUI{} - if protoimpl.UnsafeEnabled { - mi := &file_terminal_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TerminalUI) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TerminalUI) ProtoMessage() {} - -func (x *TerminalUI) ProtoReflect() protoreflect.Message { - mi := &file_terminal_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TerminalUI.ProtoReflect.Descriptor instead. -func (*TerminalUI) Descriptor() ([]byte, []int) { - return file_terminal_proto_rawDescGZIP(), []int{0} -} - -type TerminalUI_IsInteractiveResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Interactive bool `protobuf:"varint,1,opt,name=interactive,proto3" json:"interactive,omitempty"` -} - -func (x *TerminalUI_IsInteractiveResponse) Reset() { - *x = TerminalUI_IsInteractiveResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_terminal_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TerminalUI_IsInteractiveResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TerminalUI_IsInteractiveResponse) ProtoMessage() {} - -func (x *TerminalUI_IsInteractiveResponse) ProtoReflect() protoreflect.Message { - mi := &file_terminal_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TerminalUI_IsInteractiveResponse.ProtoReflect.Descriptor instead. -func (*TerminalUI_IsInteractiveResponse) Descriptor() ([]byte, []int) { - return file_terminal_proto_rawDescGZIP(), []int{0, 0} -} - -func (x *TerminalUI_IsInteractiveResponse) GetInteractive() bool { - if x != nil { - return x.Interactive - } - return false -} - -type TerminalUI_OutputRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Lines []string `protobuf:"bytes,1,rep,name=lines,proto3" json:"lines,omitempty"` -} - -func (x *TerminalUI_OutputRequest) Reset() { - *x = TerminalUI_OutputRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_terminal_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TerminalUI_OutputRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TerminalUI_OutputRequest) ProtoMessage() {} - -func (x *TerminalUI_OutputRequest) ProtoReflect() protoreflect.Message { - mi := &file_terminal_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TerminalUI_OutputRequest.ProtoReflect.Descriptor instead. -func (*TerminalUI_OutputRequest) Descriptor() ([]byte, []int) { - return file_terminal_proto_rawDescGZIP(), []int{0, 1} -} - -func (x *TerminalUI_OutputRequest) GetLines() []string { - if x != nil { - return x.Lines - } - return nil -} - -type TerminalUI_Response struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Event: - // *TerminalUI_Response_Input - Event isTerminalUI_Response_Event `protobuf_oneof:"event"` -} - -func (x *TerminalUI_Response) Reset() { - *x = TerminalUI_Response{} - if protoimpl.UnsafeEnabled { - mi := &file_terminal_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TerminalUI_Response) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TerminalUI_Response) ProtoMessage() {} - -func (x *TerminalUI_Response) ProtoReflect() protoreflect.Message { - mi := &file_terminal_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TerminalUI_Response.ProtoReflect.Descriptor instead. -func (*TerminalUI_Response) Descriptor() ([]byte, []int) { - return file_terminal_proto_rawDescGZIP(), []int{0, 2} -} - -func (m *TerminalUI_Response) GetEvent() isTerminalUI_Response_Event { - if m != nil { - return m.Event - } - return nil -} - -func (x *TerminalUI_Response) GetInput() *TerminalUI_Event_InputResp { - if x, ok := x.GetEvent().(*TerminalUI_Response_Input); ok { - return x.Input - } - return nil -} - -type isTerminalUI_Response_Event interface { - isTerminalUI_Response_Event() -} - -type TerminalUI_Response_Input struct { - Input *TerminalUI_Event_InputResp `protobuf:"bytes,1,opt,name=input,proto3,oneof"` -} - -func (*TerminalUI_Response_Input) isTerminalUI_Response_Event() {} - -type TerminalUI_Event struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Event: - // *TerminalUI_Event_Line_ - // *TerminalUI_Event_Status_ - // *TerminalUI_Event_NamedValues_ - // *TerminalUI_Event_Raw_ - // *TerminalUI_Event_Table_ - // *TerminalUI_Event_StepGroup_ - // *TerminalUI_Event_Step_ - // *TerminalUI_Event_Input_ - Event isTerminalUI_Event_Event `protobuf_oneof:"event"` -} - -func (x *TerminalUI_Event) Reset() { - *x = TerminalUI_Event{} - if protoimpl.UnsafeEnabled { - mi := &file_terminal_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TerminalUI_Event) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TerminalUI_Event) ProtoMessage() {} - -func (x *TerminalUI_Event) ProtoReflect() protoreflect.Message { - mi := &file_terminal_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TerminalUI_Event.ProtoReflect.Descriptor instead. -func (*TerminalUI_Event) Descriptor() ([]byte, []int) { - return file_terminal_proto_rawDescGZIP(), []int{0, 3} -} - -func (m *TerminalUI_Event) GetEvent() isTerminalUI_Event_Event { - if m != nil { - return m.Event - } - return nil -} - -func (x *TerminalUI_Event) GetLine() *TerminalUI_Event_Line { - if x, ok := x.GetEvent().(*TerminalUI_Event_Line_); ok { - return x.Line - } - return nil -} - -func (x *TerminalUI_Event) GetStatus() *TerminalUI_Event_Status { - if x, ok := x.GetEvent().(*TerminalUI_Event_Status_); ok { - return x.Status - } - return nil -} - -func (x *TerminalUI_Event) GetNamedValues() *TerminalUI_Event_NamedValues { - if x, ok := x.GetEvent().(*TerminalUI_Event_NamedValues_); ok { - return x.NamedValues - } - return nil -} - -func (x *TerminalUI_Event) GetRaw() *TerminalUI_Event_Raw { - if x, ok := x.GetEvent().(*TerminalUI_Event_Raw_); ok { - return x.Raw - } - return nil -} - -func (x *TerminalUI_Event) GetTable() *TerminalUI_Event_Table { - if x, ok := x.GetEvent().(*TerminalUI_Event_Table_); ok { - return x.Table - } - return nil -} - -func (x *TerminalUI_Event) GetStepGroup() *TerminalUI_Event_StepGroup { - if x, ok := x.GetEvent().(*TerminalUI_Event_StepGroup_); ok { - return x.StepGroup - } - return nil -} - -func (x *TerminalUI_Event) GetStep() *TerminalUI_Event_Step { - if x, ok := x.GetEvent().(*TerminalUI_Event_Step_); ok { - return x.Step - } - return nil -} - -func (x *TerminalUI_Event) GetInput() *TerminalUI_Event_Input { - if x, ok := x.GetEvent().(*TerminalUI_Event_Input_); ok { - return x.Input - } - return nil -} - -type isTerminalUI_Event_Event interface { - isTerminalUI_Event_Event() -} - -type TerminalUI_Event_Line_ struct { - Line *TerminalUI_Event_Line `protobuf:"bytes,1,opt,name=line,proto3,oneof"` -} - -type TerminalUI_Event_Status_ struct { - Status *TerminalUI_Event_Status `protobuf:"bytes,2,opt,name=status,proto3,oneof"` -} - -type TerminalUI_Event_NamedValues_ struct { - NamedValues *TerminalUI_Event_NamedValues `protobuf:"bytes,3,opt,name=named_values,json=namedValues,proto3,oneof"` -} - -type TerminalUI_Event_Raw_ struct { - Raw *TerminalUI_Event_Raw `protobuf:"bytes,4,opt,name=raw,proto3,oneof"` -} - -type TerminalUI_Event_Table_ struct { - Table *TerminalUI_Event_Table `protobuf:"bytes,5,opt,name=table,proto3,oneof"` -} - -type TerminalUI_Event_StepGroup_ struct { - StepGroup *TerminalUI_Event_StepGroup `protobuf:"bytes,6,opt,name=step_group,json=stepGroup,proto3,oneof"` -} - -type TerminalUI_Event_Step_ struct { - Step *TerminalUI_Event_Step `protobuf:"bytes,7,opt,name=step,proto3,oneof"` -} - -type TerminalUI_Event_Input_ struct { - Input *TerminalUI_Event_Input `protobuf:"bytes,8,opt,name=input,proto3,oneof"` -} - -func (*TerminalUI_Event_Line_) isTerminalUI_Event_Event() {} - -func (*TerminalUI_Event_Status_) isTerminalUI_Event_Event() {} - -func (*TerminalUI_Event_NamedValues_) isTerminalUI_Event_Event() {} - -func (*TerminalUI_Event_Raw_) isTerminalUI_Event_Event() {} - -func (*TerminalUI_Event_Table_) isTerminalUI_Event_Event() {} - -func (*TerminalUI_Event_StepGroup_) isTerminalUI_Event_Event() {} - -func (*TerminalUI_Event_Step_) isTerminalUI_Event_Event() {} - -func (*TerminalUI_Event_Input_) isTerminalUI_Event_Event() {} - -type TerminalUI_Event_Input struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Prompt string `protobuf:"bytes,1,opt,name=prompt,proto3" json:"prompt,omitempty"` - Style string `protobuf:"bytes,2,opt,name=style,proto3" json:"style,omitempty"` - Secret bool `protobuf:"varint,3,opt,name=secret,proto3" json:"secret,omitempty"` -} - -func (x *TerminalUI_Event_Input) Reset() { - *x = TerminalUI_Event_Input{} - if protoimpl.UnsafeEnabled { - mi := &file_terminal_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TerminalUI_Event_Input) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TerminalUI_Event_Input) ProtoMessage() {} - -func (x *TerminalUI_Event_Input) ProtoReflect() protoreflect.Message { - mi := &file_terminal_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TerminalUI_Event_Input.ProtoReflect.Descriptor instead. -func (*TerminalUI_Event_Input) Descriptor() ([]byte, []int) { - return file_terminal_proto_rawDescGZIP(), []int{0, 3, 0} -} - -func (x *TerminalUI_Event_Input) GetPrompt() string { - if x != nil { - return x.Prompt - } - return "" -} - -func (x *TerminalUI_Event_Input) GetStyle() string { - if x != nil { - return x.Style - } - return "" -} - -func (x *TerminalUI_Event_Input) GetSecret() bool { - if x != nil { - return x.Secret - } - return false -} - -type TerminalUI_Event_InputResp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Input string `protobuf:"bytes,1,opt,name=input,proto3" json:"input,omitempty"` - Error *status.Status `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` -} - -func (x *TerminalUI_Event_InputResp) Reset() { - *x = TerminalUI_Event_InputResp{} - if protoimpl.UnsafeEnabled { - mi := &file_terminal_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TerminalUI_Event_InputResp) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TerminalUI_Event_InputResp) ProtoMessage() {} - -func (x *TerminalUI_Event_InputResp) ProtoReflect() protoreflect.Message { - mi := &file_terminal_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TerminalUI_Event_InputResp.ProtoReflect.Descriptor instead. -func (*TerminalUI_Event_InputResp) Descriptor() ([]byte, []int) { - return file_terminal_proto_rawDescGZIP(), []int{0, 3, 1} -} - -func (x *TerminalUI_Event_InputResp) GetInput() string { - if x != nil { - return x.Input - } - return "" -} - -func (x *TerminalUI_Event_InputResp) GetError() *status.Status { - if x != nil { - return x.Error - } - return nil -} - -type TerminalUI_Event_Status struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` - Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` - Step bool `protobuf:"varint,3,opt,name=step,proto3" json:"step,omitempty"` -} - -func (x *TerminalUI_Event_Status) Reset() { - *x = TerminalUI_Event_Status{} - if protoimpl.UnsafeEnabled { - mi := &file_terminal_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TerminalUI_Event_Status) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TerminalUI_Event_Status) ProtoMessage() {} - -func (x *TerminalUI_Event_Status) ProtoReflect() protoreflect.Message { - mi := &file_terminal_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TerminalUI_Event_Status.ProtoReflect.Descriptor instead. -func (*TerminalUI_Event_Status) Descriptor() ([]byte, []int) { - return file_terminal_proto_rawDescGZIP(), []int{0, 3, 2} -} - -func (x *TerminalUI_Event_Status) GetStatus() string { - if x != nil { - return x.Status - } - return "" -} - -func (x *TerminalUI_Event_Status) GetMsg() string { - if x != nil { - return x.Msg - } - return "" -} - -func (x *TerminalUI_Event_Status) GetStep() bool { - if x != nil { - return x.Step - } - return false -} - -type TerminalUI_Event_Line struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` - Style string `protobuf:"bytes,2,opt,name=style,proto3" json:"style,omitempty"` -} - -func (x *TerminalUI_Event_Line) Reset() { - *x = TerminalUI_Event_Line{} - if protoimpl.UnsafeEnabled { - mi := &file_terminal_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TerminalUI_Event_Line) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TerminalUI_Event_Line) ProtoMessage() {} - -func (x *TerminalUI_Event_Line) ProtoReflect() protoreflect.Message { - mi := &file_terminal_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TerminalUI_Event_Line.ProtoReflect.Descriptor instead. -func (*TerminalUI_Event_Line) Descriptor() ([]byte, []int) { - return file_terminal_proto_rawDescGZIP(), []int{0, 3, 3} -} - -func (x *TerminalUI_Event_Line) GetMsg() string { - if x != nil { - return x.Msg - } - return "" -} - -func (x *TerminalUI_Event_Line) GetStyle() string { - if x != nil { - return x.Style - } - return "" -} - -type TerminalUI_Event_Raw struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - Stderr bool `protobuf:"varint,2,opt,name=stderr,proto3" json:"stderr,omitempty"` -} - -func (x *TerminalUI_Event_Raw) Reset() { - *x = TerminalUI_Event_Raw{} - if protoimpl.UnsafeEnabled { - mi := &file_terminal_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TerminalUI_Event_Raw) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TerminalUI_Event_Raw) ProtoMessage() {} - -func (x *TerminalUI_Event_Raw) ProtoReflect() protoreflect.Message { - mi := &file_terminal_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TerminalUI_Event_Raw.ProtoReflect.Descriptor instead. -func (*TerminalUI_Event_Raw) Descriptor() ([]byte, []int) { - return file_terminal_proto_rawDescGZIP(), []int{0, 3, 4} -} - -func (x *TerminalUI_Event_Raw) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -func (x *TerminalUI_Event_Raw) GetStderr() bool { - if x != nil { - return x.Stderr - } - return false -} - -type TerminalUI_Event_NamedValue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` -} - -func (x *TerminalUI_Event_NamedValue) Reset() { - *x = TerminalUI_Event_NamedValue{} - if protoimpl.UnsafeEnabled { - mi := &file_terminal_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TerminalUI_Event_NamedValue) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TerminalUI_Event_NamedValue) ProtoMessage() {} - -func (x *TerminalUI_Event_NamedValue) ProtoReflect() protoreflect.Message { - mi := &file_terminal_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TerminalUI_Event_NamedValue.ProtoReflect.Descriptor instead. -func (*TerminalUI_Event_NamedValue) Descriptor() ([]byte, []int) { - return file_terminal_proto_rawDescGZIP(), []int{0, 3, 5} -} - -func (x *TerminalUI_Event_NamedValue) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *TerminalUI_Event_NamedValue) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -type TerminalUI_Event_NamedValues struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Values []*TerminalUI_Event_NamedValue `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` -} - -func (x *TerminalUI_Event_NamedValues) Reset() { - *x = TerminalUI_Event_NamedValues{} - if protoimpl.UnsafeEnabled { - mi := &file_terminal_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TerminalUI_Event_NamedValues) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TerminalUI_Event_NamedValues) ProtoMessage() {} - -func (x *TerminalUI_Event_NamedValues) ProtoReflect() protoreflect.Message { - mi := &file_terminal_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TerminalUI_Event_NamedValues.ProtoReflect.Descriptor instead. -func (*TerminalUI_Event_NamedValues) Descriptor() ([]byte, []int) { - return file_terminal_proto_rawDescGZIP(), []int{0, 3, 6} -} - -func (x *TerminalUI_Event_NamedValues) GetValues() []*TerminalUI_Event_NamedValue { - if x != nil { - return x.Values - } - return nil -} - -type TerminalUI_Event_TableEntry struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` - Color string `protobuf:"bytes,2,opt,name=color,proto3" json:"color,omitempty"` -} - -func (x *TerminalUI_Event_TableEntry) Reset() { - *x = TerminalUI_Event_TableEntry{} - if protoimpl.UnsafeEnabled { - mi := &file_terminal_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TerminalUI_Event_TableEntry) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TerminalUI_Event_TableEntry) ProtoMessage() {} - -func (x *TerminalUI_Event_TableEntry) ProtoReflect() protoreflect.Message { - mi := &file_terminal_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TerminalUI_Event_TableEntry.ProtoReflect.Descriptor instead. -func (*TerminalUI_Event_TableEntry) Descriptor() ([]byte, []int) { - return file_terminal_proto_rawDescGZIP(), []int{0, 3, 7} -} - -func (x *TerminalUI_Event_TableEntry) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -func (x *TerminalUI_Event_TableEntry) GetColor() string { - if x != nil { - return x.Color - } - return "" -} - -type TerminalUI_Event_TableRow struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Entries []*TerminalUI_Event_TableEntry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` -} - -func (x *TerminalUI_Event_TableRow) Reset() { - *x = TerminalUI_Event_TableRow{} - if protoimpl.UnsafeEnabled { - mi := &file_terminal_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TerminalUI_Event_TableRow) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TerminalUI_Event_TableRow) ProtoMessage() {} - -func (x *TerminalUI_Event_TableRow) ProtoReflect() protoreflect.Message { - mi := &file_terminal_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TerminalUI_Event_TableRow.ProtoReflect.Descriptor instead. -func (*TerminalUI_Event_TableRow) Descriptor() ([]byte, []int) { - return file_terminal_proto_rawDescGZIP(), []int{0, 3, 8} -} - -func (x *TerminalUI_Event_TableRow) GetEntries() []*TerminalUI_Event_TableEntry { - if x != nil { - return x.Entries - } - return nil -} - -type TerminalUI_Event_Table struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Headers []string `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty"` - Rows []*TerminalUI_Event_TableRow `protobuf:"bytes,2,rep,name=rows,proto3" json:"rows,omitempty"` -} - -func (x *TerminalUI_Event_Table) Reset() { - *x = TerminalUI_Event_Table{} - if protoimpl.UnsafeEnabled { - mi := &file_terminal_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TerminalUI_Event_Table) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TerminalUI_Event_Table) ProtoMessage() {} - -func (x *TerminalUI_Event_Table) ProtoReflect() protoreflect.Message { - mi := &file_terminal_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TerminalUI_Event_Table.ProtoReflect.Descriptor instead. -func (*TerminalUI_Event_Table) Descriptor() ([]byte, []int) { - return file_terminal_proto_rawDescGZIP(), []int{0, 3, 9} -} - -func (x *TerminalUI_Event_Table) GetHeaders() []string { - if x != nil { - return x.Headers - } - return nil -} - -func (x *TerminalUI_Event_Table) GetRows() []*TerminalUI_Event_TableRow { - if x != nil { - return x.Rows - } - return nil -} - -type TerminalUI_Event_StepGroup struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Close bool `protobuf:"varint,1,opt,name=close,proto3" json:"close,omitempty"` -} - -func (x *TerminalUI_Event_StepGroup) Reset() { - *x = TerminalUI_Event_StepGroup{} - if protoimpl.UnsafeEnabled { - mi := &file_terminal_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TerminalUI_Event_StepGroup) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TerminalUI_Event_StepGroup) ProtoMessage() {} - -func (x *TerminalUI_Event_StepGroup) ProtoReflect() protoreflect.Message { - mi := &file_terminal_proto_msgTypes[15] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TerminalUI_Event_StepGroup.ProtoReflect.Descriptor instead. -func (*TerminalUI_Event_StepGroup) Descriptor() ([]byte, []int) { - return file_terminal_proto_rawDescGZIP(), []int{0, 3, 10} -} - -func (x *TerminalUI_Event_StepGroup) GetClose() bool { - if x != nil { - return x.Close - } - return false -} - -type TerminalUI_Event_Step struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Close bool `protobuf:"varint,2,opt,name=close,proto3" json:"close,omitempty"` - Msg string `protobuf:"bytes,3,opt,name=msg,proto3" json:"msg,omitempty"` - Status string `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"` - Output []byte `protobuf:"bytes,5,opt,name=output,proto3" json:"output,omitempty"` -} - -func (x *TerminalUI_Event_Step) Reset() { - *x = TerminalUI_Event_Step{} - if protoimpl.UnsafeEnabled { - mi := &file_terminal_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *TerminalUI_Event_Step) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TerminalUI_Event_Step) ProtoMessage() {} - -func (x *TerminalUI_Event_Step) ProtoReflect() protoreflect.Message { - mi := &file_terminal_proto_msgTypes[16] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TerminalUI_Event_Step.ProtoReflect.Descriptor instead. -func (*TerminalUI_Event_Step) Descriptor() ([]byte, []int) { - return file_terminal_proto_rawDescGZIP(), []int{0, 3, 11} -} - -func (x *TerminalUI_Event_Step) GetId() int32 { - if x != nil { - return x.Id - } - return 0 -} - -func (x *TerminalUI_Event_Step) GetClose() bool { - if x != nil { - return x.Close - } - return false -} - -func (x *TerminalUI_Event_Step) GetMsg() string { - if x != nil { - return x.Msg - } - return "" -} - -func (x *TerminalUI_Event_Step) GetStatus() string { - if x != nil { - return x.Status - } - return "" -} - -func (x *TerminalUI_Event_Step) GetOutput() []byte { - if x != nil { - return x.Output - } - return nil -} - -var File_terminal_proto protoreflect.FileDescriptor - -var file_terminal_proto_rawDesc = []byte{ - 0x0a, 0x0e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x72, 0x70, 0x63, - 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xda, 0x0b, - 0x0a, 0x0a, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x49, 0x1a, 0x39, 0x0a, 0x15, - 0x49, 0x73, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x61, 0x63, - 0x74, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x1a, 0x25, 0x0a, 0x0d, 0x4f, 0x75, 0x74, 0x70, 0x75, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6e, 0x65, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x1a, 0x4e, - 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x05, 0x69, 0x6e, - 0x70, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x49, 0x2e, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x48, 0x00, 0x52, 0x05, - 0x69, 0x6e, 0x70, 0x75, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x1a, 0x99, - 0x0a, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x32, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, - 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x49, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, - 0x4c, 0x69, 0x6e, 0x65, 0x48, 0x00, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x38, 0x0a, 0x06, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x49, 0x2e, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x06, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x48, 0x0a, 0x0c, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x49, 0x2e, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x48, 0x00, 0x52, 0x0b, 0x6e, 0x61, 0x6d, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x12, 0x2f, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x49, - 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x61, 0x77, 0x48, 0x00, 0x52, 0x03, 0x72, 0x61, - 0x77, 0x12, 0x35, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, - 0x6c, 0x55, 0x49, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x48, - 0x00, 0x52, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x42, 0x0a, 0x0a, 0x73, 0x74, 0x65, 0x70, - 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x49, 0x2e, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x74, 0x65, 0x70, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x48, - 0x00, 0x52, 0x09, 0x73, 0x74, 0x65, 0x70, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x32, 0x0a, 0x04, - 0x73, 0x74, 0x65, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x49, 0x2e, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x74, 0x65, 0x70, 0x48, 0x00, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, - 0x12, 0x35, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, - 0x55, 0x49, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x48, 0x00, - 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x1a, 0x4d, 0x0a, 0x05, 0x49, 0x6e, 0x70, 0x75, 0x74, - 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x70, 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x79, 0x6c, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x12, 0x16, - 0x0a, 0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, - 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x1a, 0x4b, 0x0a, 0x09, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x28, 0x0a, 0x05, 0x65, 0x72, 0x72, - 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x05, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x1a, 0x46, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, - 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x1a, 0x2e, 0x0a, 0x04, 0x4c, - 0x69, 0x6e, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x1a, 0x31, 0x0a, 0x03, 0x52, - 0x61, 0x77, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x73, 0x74, 0x64, 0x65, 0x72, 0x72, 0x1a, 0x36, - 0x0a, 0x0a, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x1a, 0x49, 0x0a, 0x0b, 0x4e, 0x61, 0x6d, 0x65, 0x64, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x65, - 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x49, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x4e, - 0x61, 0x6d, 0x65, 0x64, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x1a, 0x38, 0x0a, 0x0a, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, - 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x1a, 0x48, 0x0a, 0x08, 0x54, - 0x61, 0x62, 0x6c, 0x65, 0x52, 0x6f, 0x77, 0x12, 0x3c, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, - 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x49, 0x2e, 0x45, 0x76, 0x65, 0x6e, - 0x74, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x65, 0x6e, - 0x74, 0x72, 0x69, 0x65, 0x73, 0x1a, 0x57, 0x0a, 0x05, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x18, - 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x34, 0x0a, 0x04, 0x72, 0x6f, 0x77, 0x73, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, - 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x49, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x2e, - 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x6f, 0x77, 0x52, 0x04, 0x72, 0x6f, 0x77, 0x73, 0x1a, 0x21, - 0x0a, 0x09, 0x53, 0x74, 0x65, 0x70, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x63, - 0x6c, 0x6f, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x63, 0x6c, 0x6f, 0x73, - 0x65, 0x1a, 0x6e, 0x0a, 0x04, 0x53, 0x74, 0x65, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6c, 0x6f, - 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x12, - 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, - 0x67, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, - 0x70, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, - 0x74, 0x42, 0x07, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x32, 0xeb, 0x01, 0x0a, 0x11, 0x54, - 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x49, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x41, 0x0a, 0x06, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x1f, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x49, 0x2e, 0x4f, 0x75, - 0x74, 0x70, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x12, 0x41, 0x0a, 0x06, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x17, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x49, - 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, - 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x55, 0x49, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x28, 0x01, 0x30, 0x01, 0x12, 0x50, 0x0a, 0x0d, 0x49, 0x73, 0x49, 0x6e, 0x74, 0x65, - 0x72, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, - 0x27, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, - 0x55, 0x49, 0x2e, 0x49, 0x73, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x3b, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_terminal_proto_rawDescOnce sync.Once - file_terminal_proto_rawDescData = file_terminal_proto_rawDesc -) - -func file_terminal_proto_rawDescGZIP() []byte { - file_terminal_proto_rawDescOnce.Do(func() { - file_terminal_proto_rawDescData = protoimpl.X.CompressGZIP(file_terminal_proto_rawDescData) - }) - return file_terminal_proto_rawDescData -} - -var file_terminal_proto_msgTypes = make([]protoimpl.MessageInfo, 17) -var file_terminal_proto_goTypes = []interface{}{ - (*TerminalUI)(nil), // 0: proto.TerminalUI - (*TerminalUI_IsInteractiveResponse)(nil), // 1: proto.TerminalUI.IsInteractiveResponse - (*TerminalUI_OutputRequest)(nil), // 2: proto.TerminalUI.OutputRequest - (*TerminalUI_Response)(nil), // 3: proto.TerminalUI.Response - (*TerminalUI_Event)(nil), // 4: proto.TerminalUI.Event - (*TerminalUI_Event_Input)(nil), // 5: proto.TerminalUI.Event.Input - (*TerminalUI_Event_InputResp)(nil), // 6: proto.TerminalUI.Event.InputResp - (*TerminalUI_Event_Status)(nil), // 7: proto.TerminalUI.Event.Status - (*TerminalUI_Event_Line)(nil), // 8: proto.TerminalUI.Event.Line - (*TerminalUI_Event_Raw)(nil), // 9: proto.TerminalUI.Event.Raw - (*TerminalUI_Event_NamedValue)(nil), // 10: proto.TerminalUI.Event.NamedValue - (*TerminalUI_Event_NamedValues)(nil), // 11: proto.TerminalUI.Event.NamedValues - (*TerminalUI_Event_TableEntry)(nil), // 12: proto.TerminalUI.Event.TableEntry - (*TerminalUI_Event_TableRow)(nil), // 13: proto.TerminalUI.Event.TableRow - (*TerminalUI_Event_Table)(nil), // 14: proto.TerminalUI.Event.Table - (*TerminalUI_Event_StepGroup)(nil), // 15: proto.TerminalUI.Event.StepGroup - (*TerminalUI_Event_Step)(nil), // 16: proto.TerminalUI.Event.Step - (*status.Status)(nil), // 17: google.rpc.Status - (*empty.Empty)(nil), // 18: google.protobuf.Empty -} -var file_terminal_proto_depIdxs = []int32{ - 6, // 0: proto.TerminalUI.Response.input:type_name -> proto.TerminalUI.Event.InputResp - 8, // 1: proto.TerminalUI.Event.line:type_name -> proto.TerminalUI.Event.Line - 7, // 2: proto.TerminalUI.Event.status:type_name -> proto.TerminalUI.Event.Status - 11, // 3: proto.TerminalUI.Event.named_values:type_name -> proto.TerminalUI.Event.NamedValues - 9, // 4: proto.TerminalUI.Event.raw:type_name -> proto.TerminalUI.Event.Raw - 14, // 5: proto.TerminalUI.Event.table:type_name -> proto.TerminalUI.Event.Table - 15, // 6: proto.TerminalUI.Event.step_group:type_name -> proto.TerminalUI.Event.StepGroup - 16, // 7: proto.TerminalUI.Event.step:type_name -> proto.TerminalUI.Event.Step - 5, // 8: proto.TerminalUI.Event.input:type_name -> proto.TerminalUI.Event.Input - 17, // 9: proto.TerminalUI.Event.InputResp.error:type_name -> google.rpc.Status - 10, // 10: proto.TerminalUI.Event.NamedValues.values:type_name -> proto.TerminalUI.Event.NamedValue - 12, // 11: proto.TerminalUI.Event.TableRow.entries:type_name -> proto.TerminalUI.Event.TableEntry - 13, // 12: proto.TerminalUI.Event.Table.rows:type_name -> proto.TerminalUI.Event.TableRow - 2, // 13: proto.TerminalUIService.Output:input_type -> proto.TerminalUI.OutputRequest - 4, // 14: proto.TerminalUIService.Events:input_type -> proto.TerminalUI.Event - 18, // 15: proto.TerminalUIService.IsInteractive:input_type -> google.protobuf.Empty - 18, // 16: proto.TerminalUIService.Output:output_type -> google.protobuf.Empty - 3, // 17: proto.TerminalUIService.Events:output_type -> proto.TerminalUI.Response - 1, // 18: proto.TerminalUIService.IsInteractive:output_type -> proto.TerminalUI.IsInteractiveResponse - 16, // [16:19] is the sub-list for method output_type - 13, // [13:16] is the sub-list for method input_type - 13, // [13:13] is the sub-list for extension type_name - 13, // [13:13] is the sub-list for extension extendee - 0, // [0:13] is the sub-list for field type_name -} - -func init() { file_terminal_proto_init() } -func file_terminal_proto_init() { - if File_terminal_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_terminal_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TerminalUI); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_terminal_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TerminalUI_IsInteractiveResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_terminal_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TerminalUI_OutputRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_terminal_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TerminalUI_Response); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_terminal_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TerminalUI_Event); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_terminal_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TerminalUI_Event_Input); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_terminal_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TerminalUI_Event_InputResp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_terminal_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TerminalUI_Event_Status); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_terminal_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TerminalUI_Event_Line); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_terminal_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TerminalUI_Event_Raw); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_terminal_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TerminalUI_Event_NamedValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_terminal_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TerminalUI_Event_NamedValues); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_terminal_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TerminalUI_Event_TableEntry); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_terminal_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TerminalUI_Event_TableRow); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_terminal_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TerminalUI_Event_Table); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_terminal_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TerminalUI_Event_StepGroup); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_terminal_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*TerminalUI_Event_Step); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_terminal_proto_msgTypes[3].OneofWrappers = []interface{}{ - (*TerminalUI_Response_Input)(nil), - } - file_terminal_proto_msgTypes[4].OneofWrappers = []interface{}{ - (*TerminalUI_Event_Line_)(nil), - (*TerminalUI_Event_Status_)(nil), - (*TerminalUI_Event_NamedValues_)(nil), - (*TerminalUI_Event_Raw_)(nil), - (*TerminalUI_Event_Table_)(nil), - (*TerminalUI_Event_StepGroup_)(nil), - (*TerminalUI_Event_Step_)(nil), - (*TerminalUI_Event_Input_)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_terminal_proto_rawDesc, - NumEnums: 0, - NumMessages: 17, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_terminal_proto_goTypes, - DependencyIndexes: file_terminal_proto_depIdxs, - MessageInfos: file_terminal_proto_msgTypes, - }.Build() - File_terminal_proto = out.File - file_terminal_proto_rawDesc = nil - file_terminal_proto_goTypes = nil - file_terminal_proto_depIdxs = nil -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConnInterface - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion6 - -// TerminalUIServiceClient is the client API for TerminalUIService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type TerminalUIServiceClient interface { - Output(ctx context.Context, in *TerminalUI_OutputRequest, opts ...grpc.CallOption) (*empty.Empty, error) - Events(ctx context.Context, opts ...grpc.CallOption) (TerminalUIService_EventsClient, error) - IsInteractive(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*TerminalUI_IsInteractiveResponse, error) -} - -type terminalUIServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewTerminalUIServiceClient(cc grpc.ClientConnInterface) TerminalUIServiceClient { - return &terminalUIServiceClient{cc} -} - -func (c *terminalUIServiceClient) Output(ctx context.Context, in *TerminalUI_OutputRequest, opts ...grpc.CallOption) (*empty.Empty, error) { - out := new(empty.Empty) - err := c.cc.Invoke(ctx, "/proto.TerminalUIService/Output", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *terminalUIServiceClient) Events(ctx context.Context, opts ...grpc.CallOption) (TerminalUIService_EventsClient, error) { - stream, err := c.cc.NewStream(ctx, &_TerminalUIService_serviceDesc.Streams[0], "/proto.TerminalUIService/Events", opts...) - if err != nil { - return nil, err - } - x := &terminalUIServiceEventsClient{stream} - return x, nil -} - -type TerminalUIService_EventsClient interface { - Send(*TerminalUI_Event) error - Recv() (*TerminalUI_Response, error) - grpc.ClientStream -} - -type terminalUIServiceEventsClient struct { - grpc.ClientStream -} - -func (x *terminalUIServiceEventsClient) Send(m *TerminalUI_Event) error { - return x.ClientStream.SendMsg(m) -} - -func (x *terminalUIServiceEventsClient) Recv() (*TerminalUI_Response, error) { - m := new(TerminalUI_Response) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *terminalUIServiceClient) IsInteractive(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*TerminalUI_IsInteractiveResponse, error) { - out := new(TerminalUI_IsInteractiveResponse) - err := c.cc.Invoke(ctx, "/proto.TerminalUIService/IsInteractive", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// TerminalUIServiceServer is the server API for TerminalUIService service. -type TerminalUIServiceServer interface { - Output(context.Context, *TerminalUI_OutputRequest) (*empty.Empty, error) - Events(TerminalUIService_EventsServer) error - IsInteractive(context.Context, *empty.Empty) (*TerminalUI_IsInteractiveResponse, error) -} - -// UnimplementedTerminalUIServiceServer can be embedded to have forward compatible implementations. -type UnimplementedTerminalUIServiceServer struct { -} - -func (*UnimplementedTerminalUIServiceServer) Output(context.Context, *TerminalUI_OutputRequest) (*empty.Empty, error) { - return nil, status1.Errorf(codes.Unimplemented, "method Output not implemented") -} -func (*UnimplementedTerminalUIServiceServer) Events(TerminalUIService_EventsServer) error { - return status1.Errorf(codes.Unimplemented, "method Events not implemented") -} -func (*UnimplementedTerminalUIServiceServer) IsInteractive(context.Context, *empty.Empty) (*TerminalUI_IsInteractiveResponse, error) { - return nil, status1.Errorf(codes.Unimplemented, "method IsInteractive not implemented") -} - -func RegisterTerminalUIServiceServer(s *grpc.Server, srv TerminalUIServiceServer) { - s.RegisterService(&_TerminalUIService_serviceDesc, srv) -} - -func _TerminalUIService_Output_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(TerminalUI_OutputRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TerminalUIServiceServer).Output(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.TerminalUIService/Output", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TerminalUIServiceServer).Output(ctx, req.(*TerminalUI_OutputRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _TerminalUIService_Events_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(TerminalUIServiceServer).Events(&terminalUIServiceEventsServer{stream}) -} - -type TerminalUIService_EventsServer interface { - Send(*TerminalUI_Response) error - Recv() (*TerminalUI_Event, error) - grpc.ServerStream -} - -type terminalUIServiceEventsServer struct { - grpc.ServerStream -} - -func (x *terminalUIServiceEventsServer) Send(m *TerminalUI_Response) error { - return x.ServerStream.SendMsg(m) -} - -func (x *terminalUIServiceEventsServer) Recv() (*TerminalUI_Event, error) { - m := new(TerminalUI_Event) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func _TerminalUIService_IsInteractive_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(empty.Empty) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(TerminalUIServiceServer).IsInteractive(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/proto.TerminalUIService/IsInteractive", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TerminalUIServiceServer).IsInteractive(ctx, req.(*empty.Empty)) - } - return interceptor(ctx, in, info, handler) -} - -var _TerminalUIService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "proto.TerminalUIService", - HandlerType: (*TerminalUIServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Output", - Handler: _TerminalUIService_Output_Handler, - }, - { - MethodName: "IsInteractive", - Handler: _TerminalUIService_IsInteractive_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Events", - Handler: _TerminalUIService_Events_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "terminal.proto", -} diff --git a/sdk/proto/terminal.proto b/sdk/proto/terminal.proto deleted file mode 100644 index 8bd0e11c50e..00000000000 --- a/sdk/proto/terminal.proto +++ /dev/null @@ -1,108 +0,0 @@ -syntax = "proto3"; - -package proto; - -option go_package = ".;proto"; - -import "google/protobuf/empty.proto"; -import "google/rpc/status.proto"; - -// TerminalUIService is a service that provides "sdk/terminal.UI" interface -// to plugins. Plugins don't interact with this directly, they usually -// interact with it indirectly via a terminal.UI implementation. -service TerminalUIService { - rpc Output(TerminalUI.OutputRequest) returns (google.protobuf.Empty); - rpc Events(stream TerminalUI.Event) returns (stream TerminalUI.Response); - rpc IsInteractive(google.protobuf.Empty) returns (TerminalUI.IsInteractiveResponse); -} - -message TerminalUI { - message IsInteractiveResponse { - bool interactive = 1; - } - - message OutputRequest { - repeated string lines = 1; - } - - message Response { - oneof event { - Event.InputResp input = 1; - } - } - - message Event { - oneof event { - Line line = 1; - Status status = 2; - NamedValues named_values = 3; - Raw raw = 4; - Table table = 5; - StepGroup step_group = 6; - Step step = 7; - Input input = 8; - } - - message Input { - string prompt = 1; - string style = 2; - bool secret = 3; - } - - message InputResp { - string input = 1; - google.rpc.Status error = 2; - } - - message Status { - string status = 1; - string msg = 2; - bool step = 3; - } - - message Line { - string msg = 1; - string style = 2; - } - - message Raw { - bytes data = 1; - bool stderr = 2; - } - - message NamedValue { - string name = 1; - string value = 2; - } - - message NamedValues { - repeated NamedValue values = 1; - } - - message TableEntry { - string value = 1; - string color = 2; - } - - message TableRow { - repeated TableEntry entries = 1; - } - - message Table { - repeated string headers = 1; - repeated TableRow rows = 2; - } - - message StepGroup { - bool close = 1; - } - - message Step { - int32 id = 1; - bool close = 2; - string msg = 3; - string status = 4; - bytes output = 5; - } - } -} diff --git a/sdk/terminal/basic.go b/sdk/terminal/basic.go deleted file mode 100644 index 965a07a3b78..00000000000 --- a/sdk/terminal/basic.go +++ /dev/null @@ -1,185 +0,0 @@ -package terminal - -import ( - "bufio" - "bytes" - "context" - "fmt" - "io" - "os" - "strings" - "text/tabwriter" - - "github.com/bgentry/speakeasy" - "github.com/creack/pty" - "github.com/fatih/color" - "github.com/mattn/go-isatty" - sshterm "golang.org/x/crypto/ssh/terminal" -) - -// basicUI -type basicUI struct { - ctx context.Context - status *spinnerStatus -} - -// Returns a UI which will write to the current processes -// stdout/stderr. -func ConsoleUI(ctx context.Context) UI { - // We do both of these checks because some sneaky environments fool - // one or the other and we really only want the glint-based UI in - // truly interactive environments. - glint := isatty.IsTerminal(os.Stdout.Fd()) && sshterm.IsTerminal(int(os.Stdout.Fd())) - if glint { - ws, err := pty.GetsizeFull(os.Stdout) - glint = err == nil && ws.Rows > 0 && ws.Cols > 0 - } - - if glint { - return GlintUI(ctx) - } else { - return NonInteractiveUI(ctx) - } -} - -// Input implements UI -func (ui *basicUI) Input(input *Input) (string, error) { - var buf bytes.Buffer - - // Write the prompt, add a space. - ui.Output(input.Prompt, WithStyle(input.Style), WithWriter(&buf)) - fmt.Fprint(color.Output, strings.TrimRight(buf.String(), "\r\n")) - fmt.Fprint(color.Output, " ") - - // Ask for input in a go-routine so that we can ignore it. - errCh := make(chan error, 1) - lineCh := make(chan string, 1) - go func() { - var line string - var err error - if input.Secret && isatty.IsTerminal(os.Stdin.Fd()) { - line, err = speakeasy.Ask("") - } else { - r := bufio.NewReader(os.Stdin) - line, err = r.ReadString('\n') - } - if err != nil { - errCh <- err - return - } - - lineCh <- strings.TrimRight(line, "\r\n") - }() - - select { - case err := <-errCh: - return "", err - case line := <-lineCh: - return line, nil - case <-ui.ctx.Done(): - // Print newline so that any further output starts properly - fmt.Fprintln(color.Output) - return "", ui.ctx.Err() - } -} - -// Interactive implements UI -func (ui *basicUI) Interactive() bool { - return isatty.IsTerminal(os.Stdin.Fd()) -} - -// Output implements UI -func (ui *basicUI) Output(msg string, raw ...interface{}) { - msg, style, w := Interpret(msg, raw...) - - switch style { - case HeaderStyle: - msg = colorHeader.Sprintf("\n==> %s", msg) - case ErrorStyle: - msg = colorError.Sprint(msg) - case ErrorBoldStyle: - msg = colorErrorBold.Sprint(msg) - case WarningStyle: - msg = colorWarning.Sprint(msg) - case WarningBoldStyle: - msg = colorWarningBold.Sprint(msg) - case SuccessStyle: - msg = colorSuccess.Sprint(msg) - case SuccessBoldStyle: - msg = colorSuccessBold.Sprint(msg) - case InfoStyle: - lines := strings.Split(msg, "\n") - for i, line := range lines { - lines[i] = colorInfo.Sprintf(" %s", line) - } - - msg = strings.Join(lines, "\n") - } - - st := ui.status - if st != nil { - if st.Pause() { - defer st.Start() - } - } - - // Write it - fmt.Fprintln(w, msg) -} - -// NamedValues implements UI -func (ui *basicUI) NamedValues(rows []NamedValue, opts ...Option) { - cfg := &config{Writer: color.Output} - for _, opt := range opts { - opt(cfg) - } - - var buf bytes.Buffer - tr := tabwriter.NewWriter(&buf, 1, 8, 0, ' ', tabwriter.AlignRight) - for _, row := range rows { - switch v := row.Value.(type) { - case int, uint, int8, uint8, int16, uint16, int32, uint32, int64, uint64: - fmt.Fprintf(tr, " %s: \t%d\n", row.Name, row.Value) - case float32, float64: - fmt.Fprintf(tr, " %s: \t%f\n", row.Name, row.Value) - case bool: - fmt.Fprintf(tr, " %s: \t%v\n", row.Name, row.Value) - case string: - if v == "" { - continue - } - fmt.Fprintf(tr, " %s: \t%s\n", row.Name, row.Value) - default: - fmt.Fprintf(tr, " %s: \t%s\n", row.Name, row.Value) - } - } - - tr.Flush() - colorInfo.Fprintln(cfg.Writer, buf.String()) -} - -// OutputWriters implements UI -func (ui *basicUI) OutputWriters() (io.Writer, io.Writer, error) { - return os.Stdout, os.Stderr, nil -} - -// Status implements UI -func (ui *basicUI) Status() Status { - if ui.status == nil { - ui.status = newSpinnerStatus(ui.ctx) - } - - return ui.status -} - -func (ui *basicUI) StepGroup() StepGroup { - ctx, cancel := context.WithCancel(ui.ctx) - display := NewDisplay(ctx, color.Output) - - return &fancyStepGroup{ - ctx: ctx, - cancel: cancel, - display: display, - done: make(chan struct{}), - } -} diff --git a/sdk/terminal/display.go b/sdk/terminal/display.go deleted file mode 100644 index 9a0cc1dbb14..00000000000 --- a/sdk/terminal/display.go +++ /dev/null @@ -1,453 +0,0 @@ -package terminal - -import ( - "context" - "fmt" - "io" - "os" - "strings" - "sync" - "time" - - "github.com/briandowns/spinner" - "github.com/creack/pty" - "github.com/lab47/vterm/parser" - "github.com/lab47/vterm/screen" - "github.com/lab47/vterm/state" - "github.com/morikuni/aec" -) - -var spinnerSet = spinner.CharSets[11] - -type DisplayEntry struct { - d *Display - line uint - index int - indent int - spinner bool - text string - status string - - body []string - - next *DisplayEntry -} - -type Display struct { - mu sync.Mutex - Entries []*DisplayEntry - - w io.Writer - newEnt chan *DisplayEntry - updates chan *DisplayEntry - resize chan struct{} // sent to when an entry has resized itself. - line uint - width int - - wg sync.WaitGroup - spinning int -} - -func NewDisplay(ctx context.Context, w io.Writer) *Display { - d := &Display{ - w: w, - width: 80, - updates: make(chan *DisplayEntry), - resize: make(chan struct{}), - newEnt: make(chan *DisplayEntry), - } - - if f, ok := w.(*os.File); ok { - _, cols, err := pty.Getsize(f) - if err == nil && cols >= 10 { - d.width = cols - 1 - } - } - - d.wg.Add(1) - go func() { - defer d.wg.Done() - d.Display(ctx) - }() - - return d -} - -func (d *Display) Close() error { - d.wg.Wait() - return nil -} - -func (d *Display) flushAll() { - d.mu.Lock() - defer d.mu.Unlock() - - for range d.Entries { - fmt.Fprintln(d.w, "") - } - - d.line = uint(len(d.Entries)) -} - -func (d *Display) renderEntry(ent *DisplayEntry, spin int) { - b := aec.EmptyBuilder - - diff := d.line - ent.line - - text := strings.TrimRight(ent.text, " \t\n") - - if len(text) >= d.width { - text = text[:d.width-1] - } - - prefix := "" - if ent.spinner { - prefix = spinnerSet[spin] + " " - } - - var statusColor *aec.Builder - if ent.status != "" { - icon, ok := statusIcons[ent.status] - if !ok { - icon = ent.status - } - - if len(prefix) > 0 { - prefix = prefix + " " + icon + " " - } else { - prefix = icon + " " - } - - if codes, ok := colorStatus[ent.status]; ok { - statusColor = b.With(codes...) - } - } - - line := fmt.Sprintf("%s%s%s", - b. - Up(diff). - Column(0). - EraseLine(aec.EraseModes.All). - ANSI, - prefix, - text, - ) - - if statusColor != nil { - line = statusColor.ANSI.Apply(line) - } - - fmt.Fprint(d.w, line) - - for _, body := range ent.body { - fmt.Fprintf(d.w, "%s%s", - b. - Down(1). - Column(0). - ANSI, - body, - ) - diff-- - } - - fmt.Fprintf(d.w, "%s", - b. - Down(diff). - Column(0). - ANSI, - ) -} - -func (d *Display) Display(ctx context.Context) { - // d.flushAll() - - ticker := time.NewTicker(time.Second / 6) - - var spin int - - for { - select { - case <-ctx.Done(): - return - case <-ticker.C: - spin++ - if spin >= len(spinnerSet) { - spin = 0 - } - - d.mu.Lock() - update := d.spinning > 0 - - if !update { - d.mu.Unlock() - continue - } - - for _, ent := range d.Entries { - if !ent.spinner { - continue - } - - d.renderEntry(ent, spin) - } - - d.mu.Unlock() - case ent := <-d.newEnt: - d.mu.Lock() - ent.line = d.line - d.Entries = append(d.Entries, ent) - d.line++ - d.line += uint(len(ent.body)) - fmt.Fprintln(d.w, "") - for i := 0; i < len(ent.body); i++ { - fmt.Fprintln(d.w, "") - } - - d.mu.Unlock() - - case ent := <-d.updates: - d.mu.Lock() - d.renderEntry(ent, spin) - d.mu.Unlock() - case <-d.resize: - d.mu.Lock() - - var newLine uint - - for _, ent := range d.Entries { - newLine++ - newLine += uint(len(ent.body)) - } - - diff := newLine - d.line - - // TODO should we support shrinking? - if diff > 0 { - // Pad down - for i := uint(0); i < diff; i++ { - fmt.Fprintln(d.w, "") - } - - d.line = newLine - - var cnt uint - - for _, ent := range d.Entries { - ent.line = cnt - cnt++ - cnt += uint(len(ent.body)) - - d.renderEntry(ent, spin) - } - } - - d.mu.Unlock() - } - } -} - -func (d *Display) NewStatus(indent int) *DisplayEntry { - de := &DisplayEntry{ - d: d, - indent: indent, - } - - d.newEnt <- de - - return de -} - -func (d *Display) NewStatusWithBody(indent, lines int) *DisplayEntry { - de := &DisplayEntry{ - d: d, - indent: indent, - body: make([]string, lines), - } - - d.newEnt <- de - - return de -} - -func (e *DisplayEntry) StartSpinner() { - e.d.mu.Lock() - - e.spinner = true - e.d.spinning++ - - e.d.mu.Unlock() - - e.d.updates <- e -} - -func (e *DisplayEntry) StopSpinner() { - e.d.mu.Lock() - - e.spinner = false - e.d.spinning-- - - e.d.mu.Unlock() - - e.d.updates <- e -} - -func (e *DisplayEntry) SetStatus(status string) { - e.d.mu.Lock() - defer e.d.mu.Unlock() - - e.status = status -} - -func (e *DisplayEntry) Update(str string, args ...interface{}) { - e.d.mu.Lock() - e.text = fmt.Sprintf(str, args...) - e.d.mu.Unlock() - - e.d.updates <- e -} - -func (e *DisplayEntry) SetBody(line int, data string) { - e.d.mu.Lock() - - var resize bool - - if line >= len(e.body) { - nb := make([]string, line+1) - - for i, s := range e.body { - nb[i] = s - } - - e.body = nb - resize = true - } - - e.body[line] = data - e.d.mu.Unlock() - - if resize { - e.d.resize <- struct{}{} - } - - e.d.updates <- e -} - -type Term struct { - ent *DisplayEntry - scr *screen.Screen - w io.Writer - ctx context.Context - cancel func() - - output [][]rune - - wg sync.WaitGroup - parseErr error -} - -func (t *Term) DamageDone(r state.Rect, cr screen.CellReader) error { - for row := r.Start.Row; row <= r.End.Row; row++ { - for col := r.Start.Col; col <= r.End.Col; col++ { - cell := cr.GetCell(row, col) - - if cell == nil { - t.output[row][col] = ' ' - } else { - val, _ := cell.Value() - - if val == 0 { - t.output[row][col] = ' ' - } else { - t.output[row][col] = val - } - } - } - } - - for row := r.Start.Row; row <= r.End.Row; row++ { - b := aec.EmptyBuilder - blue := b.LightBlueF() - t.ent.SetBody(row, fmt.Sprintf(" │ %s%s%s", blue.ANSI, string(t.output[row]), aec.Reset)) - } - - return nil -} - -func (t *Term) MoveCursor(p state.Pos) error { - // Ignore it. - return nil -} - -func (t *Term) SetTermProp(attr state.TermAttr, val interface{}) error { - // Ignore it. - return nil -} - -func (t *Term) Output(data []byte) error { - // Ignore it. - return nil -} - -func (t *Term) StringEvent(kind string, data []byte) error { - // Ignore them. - return nil -} - -func NewTerm(ctx context.Context, d *DisplayEntry, height, width int) (*Term, error) { - term := &Term{ - ent: d, - output: make([][]rune, height), - } - - for i := range term.output { - term.output[i] = make([]rune, width) - } - - scr, err := screen.NewScreen(height, width, term) - if err != nil { - return nil, err - } - - term.scr = scr - - st, err := state.NewState(height, width, scr) - if err != nil { - return nil, err - } - - r, w, err := os.Pipe() - if err != nil { - return nil, err - } - - term.w = w - - prs, err := parser.NewParser(r, st) - if err != nil { - return nil, err - } - - term.ctx, term.cancel = context.WithCancel(ctx) - - term.wg.Add(1) - go func() { - defer term.wg.Done() - - err := prs.Drive(term.ctx) - if err != nil && err != context.Canceled { - term.parseErr = err - } - }() - - return term, nil -} - -func (t *Term) Write(b []byte) (int, error) { - return t.w.Write(b) -} - -func (t *Term) Close() error { - t.cancel() - t.wg.Wait() - return t.parseErr -} diff --git a/sdk/terminal/doc.go b/sdk/terminal/doc.go deleted file mode 100644 index ae1b6e64a48..00000000000 --- a/sdk/terminal/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// Package terminal is used by plugins to read and write to a terminal -// UI. The abstractions presented in this package are meant to be portable -// across a variety of styles that may be presented to the user and enables -// plugins to focus on their core logic. -// -// The primary interface to look at is UI. -package terminal diff --git a/sdk/terminal/glint.go b/sdk/terminal/glint.go deleted file mode 100644 index 34adbeb43d4..00000000000 --- a/sdk/terminal/glint.go +++ /dev/null @@ -1,193 +0,0 @@ -package terminal - -import ( - "bytes" - "context" - "fmt" - "io" - "os" - "strings" - "text/tabwriter" - - "github.com/mitchellh/go-glint" - "github.com/olekukonko/tablewriter" -) - -type glintUI struct { - d *glint.Document -} - -func GlintUI(ctx context.Context) UI { - result := &glintUI{ - d: glint.New(), - } - - go result.d.Render(ctx) - - return result -} - -func (ui *glintUI) Close() error { - return ui.d.Close() -} - -func (ui *glintUI) Input(input *Input) (string, error) { - return "", ErrNonInteractive -} - -// Interactive implements UI -func (ui *glintUI) Interactive() bool { - // TODO(mitchellh): We can make this interactive later but Glint itself - // doesn't support input yet. We can pause the document, do some input, - // then resume potentially. - return false -} - -// Output implements UI -func (ui *glintUI) Output(msg string, raw ...interface{}) { - msg, style, _ := Interpret(msg, raw...) - - var cs []glint.StyleOption - switch style { - case HeaderStyle: - cs = append(cs, glint.Bold()) - msg = "\n» " + msg - case ErrorStyle, ErrorBoldStyle: - cs = append(cs, glint.Color("lightRed")) - if style == ErrorBoldStyle { - cs = append(cs, glint.Bold()) - } - - lines := strings.Split(msg, "\n") - if len(lines) > 0 { - ui.d.Append(glint.Finalize( - glint.Style( - glint.Text("! "+lines[0]), - cs..., - ), - )) - - for _, line := range lines[1:] { - ui.d.Append(glint.Finalize( - glint.Text(" " + line), - )) - } - } - - return - - case WarningStyle, WarningBoldStyle: - cs = append(cs, glint.Color("lightYellow")) - if style == WarningBoldStyle { - cs = append(cs, glint.Bold()) - } - - case SuccessStyle, SuccessBoldStyle: - cs = append(cs, glint.Color("lightGreen")) - if style == SuccessBoldStyle { - cs = append(cs, glint.Bold()) - } - - msg = colorSuccess.Sprint(msg) - - case InfoStyle: - lines := strings.Split(msg, "\n") - for i, line := range lines { - lines[i] = colorInfo.Sprintf(" %s", line) - } - - msg = strings.Join(lines, "\n") - } - - ui.d.Append(glint.Finalize( - glint.Style( - glint.Text(msg), - cs..., - ), - )) -} - -// NamedValues implements UI -func (ui *glintUI) NamedValues(rows []NamedValue, opts ...Option) { - cfg := &config{} - for _, opt := range opts { - opt(cfg) - } - - var buf bytes.Buffer - tr := tabwriter.NewWriter(&buf, 1, 8, 0, ' ', tabwriter.AlignRight) - for _, row := range rows { - switch v := row.Value.(type) { - case int, uint, int8, uint8, int16, uint16, int32, uint32, int64, uint64: - fmt.Fprintf(tr, " %s: \t%d\n", row.Name, row.Value) - case float32, float64: - fmt.Fprintf(tr, " %s: \t%f\n", row.Name, row.Value) - case bool: - fmt.Fprintf(tr, " %s: \t%v\n", row.Name, row.Value) - case string: - if v == "" { - continue - } - fmt.Fprintf(tr, " %s: \t%s\n", row.Name, row.Value) - default: - fmt.Fprintf(tr, " %s: \t%s\n", row.Name, row.Value) - } - } - tr.Flush() - - // We want to trim the trailing newline - text := buf.String() - if len(text) > 0 && text[len(text)-1] == '\n' { - text = text[:len(text)-1] - } - - ui.d.Append(glint.Finalize(glint.Text(text))) -} - -// OutputWriters implements UI -func (ui *glintUI) OutputWriters() (io.Writer, io.Writer, error) { - return os.Stdout, os.Stderr, nil -} - -// Status implements UI -func (ui *glintUI) Status() Status { - st := newGlintStatus() - ui.d.Append(st) - return st -} - -func (ui *glintUI) StepGroup() StepGroup { - ctx, cancel := context.WithCancel(context.Background()) - sg := &glintStepGroup{ctx: ctx, cancel: cancel} - ui.d.Append(sg) - return sg -} - -// Table implements UI -func (ui *glintUI) Table(tbl *Table, opts ...Option) { - var buf bytes.Buffer - table := tablewriter.NewWriter(&buf) - table.SetHeader(tbl.Headers) - table.SetBorder(false) - table.SetAutoWrapText(false) - - for _, row := range tbl.Rows { - colors := make([]tablewriter.Colors, len(row)) - entries := make([]string, len(row)) - - for i, ent := range row { - entries[i] = ent.Value - - color, ok := colorMapping[ent.Color] - if ok { - colors[i] = tablewriter.Colors{color} - } - } - - table.Rich(entries, colors) - } - - table.Render() - - ui.d.Append(glint.Finalize(glint.Text(buf.String()))) -} diff --git a/sdk/terminal/glint_status.go b/sdk/terminal/glint_status.go deleted file mode 100644 index 95bef0b5926..00000000000 --- a/sdk/terminal/glint_status.go +++ /dev/null @@ -1,104 +0,0 @@ -package terminal - -import ( - "context" - "sync" - - "github.com/mitchellh/go-glint" - gc "github.com/mitchellh/go-glint/components" -) - -// glintStatus implements Status and uses a spinner to show updates. -type glintStatus struct { - mu sync.Mutex - closed bool - msg string - spinner glint.Component - text []glint.Component -} - -func newGlintStatus() *glintStatus { - return &glintStatus{ - spinner: gc.Spinner(), - } -} - -func (s *glintStatus) Update(msg string) { - s.mu.Lock() - defer s.mu.Unlock() - s.msg = msg -} - -func (s *glintStatus) Step(status, msg string) { - s.mu.Lock() - defer s.mu.Unlock() - - // Determine our color - var style []glint.StyleOption - switch status { - case StatusOK: - style = append(style, glint.Color("lightGreen")) - - case StatusError: - style = append(style, glint.Color("lightRed")) - - case StatusWarn: - style = append(style, glint.Color("lightYellow")) - } - - // If we have a prefix, set that - if icon, ok := statusIcons[status]; ok { - msg = icon + " " + msg - } - - // Clear the message so we don't draw a spinner - s.msg = "" - - // Add our final message - s.text = append(s.text, glint.Finalize(glint.Style( - glint.Text(msg), - style..., - ))) -} - -func (s *glintStatus) Close() error { - s.mu.Lock() - defer s.mu.Unlock() - s.closed = true - return nil -} - -func (s *glintStatus) reset() { - s.mu.Lock() - defer s.mu.Unlock() - s.text = nil - s.msg = "" -} - -func (s *glintStatus) Body(context.Context) glint.Component { - s.mu.Lock() - defer s.mu.Unlock() - - var cs []glint.Component - - // If we have text we draw that first - if len(s.text) > 0 { - cs = append(cs, glint.Finalize(glint.Fragment(s.text...))) - } - - // If we have a message the spinner is active and we draw that - if !s.closed && len(s.msg) > 0 { - cs = append(cs, glint.Layout( - s.spinner, - glint.Text(" "), - glint.Text(s.msg), - ).Row()) - } - - c := glint.Fragment(cs...) - if s.closed { - c = glint.Finalize(c) - } - - return c -} diff --git a/sdk/terminal/glint_step_group.go b/sdk/terminal/glint_step_group.go deleted file mode 100644 index 9bc3a2fa225..00000000000 --- a/sdk/terminal/glint_step_group.go +++ /dev/null @@ -1,172 +0,0 @@ -package terminal - -import ( - "context" - "fmt" - "io" - "sync" - - "github.com/mitchellh/go-glint" -) - -// glintStepGroup implements StepGroup with live updating and a display -// "window" for live terminal output (when using TermOutput). -type glintStepGroup struct { - mu sync.Mutex - ctx context.Context - cancel context.CancelFunc - wg sync.WaitGroup - steps []*glintStep - closed bool -} - -// Start a step in the output -func (f *glintStepGroup) Add(str string, args ...interface{}) Step { - f.mu.Lock() - defer f.mu.Unlock() - - // Build our step - step := &glintStep{ctx: f.ctx, status: newGlintStatus()} - - // Setup initial status - step.Update(str, args...) - - // If we're closed we don't add this step to our waitgroup or document. - // We still create a step and return a non-nil step so downstreams don't - // crash. - if !f.closed { - // Add since we have a step - step.wg = &f.wg - f.wg.Add(1) - - // Add it to our list - f.steps = append(f.steps, step) - } - - return step -} - -func (f *glintStepGroup) Wait() { - f.mu.Lock() - f.closed = true - f.cancel() - wg := &f.wg - f.mu.Unlock() - - wg.Wait() -} - -func (f *glintStepGroup) Body(context.Context) glint.Component { - f.mu.Lock() - defer f.mu.Unlock() - - var cs []glint.Component - for _, s := range f.steps { - cs = append(cs, s) - } - - return glint.Fragment(cs...) -} - -type glintStep struct { - mu sync.Mutex - ctx context.Context - wg *sync.WaitGroup - done bool - msg string - statusVal string - status *glintStatus - term *glintTerm -} - -func (f *glintStep) TermOutput() io.Writer { - f.mu.Lock() - defer f.mu.Unlock() - - if f.term == nil { - t, err := newGlintTerm(f.ctx, 10, 80) - if err != nil { - panic(err) - } - - f.term = t - } - - return f.term -} - -func (f *glintStep) Update(str string, args ...interface{}) { - f.mu.Lock() - defer f.mu.Unlock() - f.msg = fmt.Sprintf(str, args...) - f.status.reset() - - if f.statusVal != "" { - f.status.Step(f.statusVal, f.msg) - } else { - f.status.Update(f.msg) - } -} - -func (f *glintStep) Status(status string) { - f.mu.Lock() - defer f.mu.Unlock() - f.statusVal = status - f.status.reset() - f.status.Step(status, f.msg) -} - -func (f *glintStep) Done() { - f.mu.Lock() - defer f.mu.Unlock() - - if f.done { - return - } - - // Set done - f.done = true - - // Set status - if f.statusVal == "" { - f.status.reset() - f.status.Step(StatusOK, f.msg) - } - - // Unset the waitgroup - f.wg.Done() -} - -func (f *glintStep) Abort() { - f.mu.Lock() - defer f.mu.Unlock() - - if f.done { - return - } - - f.done = true - - // This will cause the term to render the full scrollback from now on - if f.term != nil { - f.term.showFull() - } - - f.status.Step(StatusError, f.msg) - f.wg.Done() -} - -func (f *glintStep) Body(context.Context) glint.Component { - f.mu.Lock() - defer f.mu.Unlock() - - var cs []glint.Component - cs = append(cs, f.status) - - // If we have a terminal, output that too. - if f.term != nil { - cs = append(cs, f.term) - } - - return glint.Fragment(cs...) -} diff --git a/sdk/terminal/glint_term.go b/sdk/terminal/glint_term.go deleted file mode 100644 index 5961d898ed5..00000000000 --- a/sdk/terminal/glint_term.go +++ /dev/null @@ -1,181 +0,0 @@ -package terminal - -import ( - "context" - "io" - "os" - "strings" - "sync" - "unicode" - - "github.com/lab47/vterm/parser" - "github.com/lab47/vterm/screen" - "github.com/lab47/vterm/state" - "github.com/mitchellh/go-glint" -) - -type glintTerm struct { - mu sync.Mutex - - w io.Writer - scr *screen.Screen - ctx context.Context - cancel func() - - output [][]rune - height, width int - - wg sync.WaitGroup - parseErr error - - scrollback [][]rune - - full bool -} - -func (t *glintTerm) Body(ctx context.Context) glint.Component { - t.mu.Lock() - defer t.mu.Unlock() - - var cs []glint.Component - - if t.full { - for _, row := range t.scrollback { - s := strings.TrimRightFunc(string(row), unicode.IsSpace) - cs = append(cs, glint.Layout(glint.Text(" │ "), glint.Text(s)).Row()) - } - } - - for _, row := range t.output { - cs = append(cs, glint.Layout( - glint.Text(" │ "), - glint.Style( - glint.Text(strings.TrimRightFunc(string(row), unicode.IsSpace)), - glint.Color("lightBlue"), - ), - ).Row()) - } - - return glint.Fragment(cs...) -} - -func (t *glintTerm) DamageDone(r state.Rect, cr screen.CellReader) error { - t.mu.Lock() - defer t.mu.Unlock() - - for row := r.Start.Row; row <= r.End.Row; row++ { - for col := r.Start.Col; col <= r.End.Col; col++ { - cell := cr.GetCell(row, col) - - for len(t.output) <= row { - t.output = append(t.output, make([]rune, t.width)) - } - - if cell == nil { - t.output[row][col] = ' ' - } else { - val, _ := cell.Value() - - if val == 0 { - t.output[row][col] = ' ' - } else { - t.output[row][col] = val - } - } - } - } - - return nil -} - -func (t *glintTerm) MoveCursor(p state.Pos) error { - // Ignore it. - return nil -} - -func (t *glintTerm) SetTermProp(attr state.TermAttr, val interface{}) error { - // Ignore it. - return nil -} - -func (t *glintTerm) Output(data []byte) error { - // Ignore it. - return nil -} - -func (t *glintTerm) StringEvent(kind string, data []byte) error { - // Ignore them. - return nil -} - -func newGlintTerm(ctx context.Context, height, width int) (*glintTerm, error) { - term := &glintTerm{ - height: height, - width: width, - } - - scr, err := screen.NewScreen(height, width, term) - if err != nil { - return nil, err - } - - term.scr = scr - - st, err := state.NewState(height, width, scr) - if err != nil { - return nil, err - } - - r, w, err := os.Pipe() - if err != nil { - return nil, err - } - - term.w = w - - prs, err := parser.NewParser(r, st) - if err != nil { - return nil, err - } - - term.ctx, term.cancel = context.WithCancel(ctx) - - term.wg.Add(1) - go func() { - defer term.wg.Done() - - err := prs.Drive(term.ctx) - if err != nil && err != context.Canceled { - term.parseErr = err - } - }() - - return term, nil -} - -func (t *glintTerm) Write(b []byte) (int, error) { - return t.w.Write(b) -} - -func (t *glintTerm) AddScrollBack(line []rune) error { - t.mu.Lock() - defer t.mu.Unlock() - - t.scrollback = append(t.scrollback, line) - return nil -} - -func (t *glintTerm) showFull() { - t.mu.Lock() - defer t.mu.Unlock() - - t.full = true -} - -var _ screen.ScrollBack = (*glintTerm)(nil) - -func (t *glintTerm) Close() error { - t.cancel() - t.wg.Wait() - return t.parseErr -} diff --git a/sdk/terminal/input.go b/sdk/terminal/input.go deleted file mode 100644 index d8ec17374a1..00000000000 --- a/sdk/terminal/input.go +++ /dev/null @@ -1,15 +0,0 @@ -package terminal - -// Input is the configuration for an input. -type Input struct { - // Prompt is a single-line prompt to give the user such as "Continue?" - // The user will input their answer after this prompt. - Prompt string - - // Style is the style to apply to the input. If this is blank, - // the output won't be colorized in any way. - Style string - - // True if this input is a secret. The input will be masked. - Secret bool -} diff --git a/sdk/terminal/noninteractive.go b/sdk/terminal/noninteractive.go deleted file mode 100644 index 297f0f65636..00000000000 --- a/sdk/terminal/noninteractive.go +++ /dev/null @@ -1,260 +0,0 @@ -package terminal - -import ( - "bytes" - "context" - "fmt" - "io" - "os" - "regexp" - "strings" - "sync" - "text/tabwriter" - - "github.com/fatih/color" - "github.com/olekukonko/tablewriter" -) - -type nonInteractiveUI struct { - mu sync.Mutex -} - -func NonInteractiveUI(ctx context.Context) UI { - result := &nonInteractiveUI{} - return result -} - -func (ui *nonInteractiveUI) Input(input *Input) (string, error) { - return "", ErrNonInteractive -} - -// Interactive implements UI -func (ui *nonInteractiveUI) Interactive() bool { - return false -} - -// Output implements UI -func (ui *nonInteractiveUI) Output(msg string, raw ...interface{}) { - ui.mu.Lock() - defer ui.mu.Unlock() - msg, style, w := Interpret(msg, raw...) - - switch style { - case HeaderStyle: - msg = "\n» " + msg - case ErrorStyle, ErrorBoldStyle: - lines := strings.Split(msg, "\n") - if len(lines) > 0 { - fmt.Fprintln(w, "! "+lines[0]) - for _, line := range lines[1:] { - fmt.Fprintln(w, " "+line) - } - } - - return - - case WarningStyle, WarningBoldStyle: - msg = "warning: " + msg - - case SuccessStyle, SuccessBoldStyle: - - case InfoStyle: - lines := strings.Split(msg, "\n") - for i, line := range lines { - lines[i] = colorInfo.Sprintf(" %s", line) - } - - msg = strings.Join(lines, "\n") - } - - fmt.Fprintln(w, msg) -} - -// NamedValues implements UI -func (ui *nonInteractiveUI) NamedValues(rows []NamedValue, opts ...Option) { - ui.mu.Lock() - defer ui.mu.Unlock() - - cfg := &config{Writer: color.Output} - for _, opt := range opts { - opt(cfg) - } - - var buf bytes.Buffer - tr := tabwriter.NewWriter(&buf, 1, 8, 0, ' ', tabwriter.AlignRight) - for _, row := range rows { - switch v := row.Value.(type) { - case int, uint, int8, uint8, int16, uint16, int32, uint32, int64, uint64: - fmt.Fprintf(tr, " %s: \t%d\n", row.Name, row.Value) - case float32, float64: - fmt.Fprintf(tr, " %s: \t%f\n", row.Name, row.Value) - case bool: - fmt.Fprintf(tr, " %s: \t%v\n", row.Name, row.Value) - case string: - if v == "" { - continue - } - fmt.Fprintf(tr, " %s: \t%s\n", row.Name, row.Value) - default: - fmt.Fprintf(tr, " %s: \t%s\n", row.Name, row.Value) - } - } - tr.Flush() - - fmt.Fprintln(cfg.Writer, buf.String()) -} - -// OutputWriters implements UI -func (ui *nonInteractiveUI) OutputWriters() (io.Writer, io.Writer, error) { - return os.Stdout, os.Stderr, nil -} - -// Status implements UI -func (ui *nonInteractiveUI) Status() Status { - return &nonInteractiveStatus{mu: &ui.mu} -} - -func (ui *nonInteractiveUI) StepGroup() StepGroup { - return &nonInteractiveStepGroup{mu: &ui.mu} -} - -// Table implements UI -func (ui *nonInteractiveUI) Table(tbl *Table, opts ...Option) { - ui.mu.Lock() - defer ui.mu.Unlock() - - // Build our config and set our options - cfg := &config{Writer: color.Output} - for _, opt := range opts { - opt(cfg) - } - - table := tablewriter.NewWriter(cfg.Writer) - table.SetHeader(tbl.Headers) - table.SetBorder(false) - table.SetAutoWrapText(false) - - for _, row := range tbl.Rows { - colors := make([]tablewriter.Colors, len(row)) - entries := make([]string, len(row)) - - for i, ent := range row { - entries[i] = ent.Value - - color, ok := colorMapping[ent.Color] - if ok { - colors[i] = tablewriter.Colors{color} - } - } - - table.Rich(entries, colors) - } - - table.Render() -} - -type nonInteractiveStatus struct { - mu *sync.Mutex -} - -func (s *nonInteractiveStatus) Update(msg string) { - s.mu.Lock() - defer s.mu.Unlock() - fmt.Fprintln(color.Output, msg) -} - -func (s *nonInteractiveStatus) Step(status, msg string) { - s.mu.Lock() - defer s.mu.Unlock() - fmt.Fprintf(color.Output, "%s: %s\n", textStatus[status], msg) -} - -func (s *nonInteractiveStatus) Close() error { - return nil -} - -type nonInteractiveStepGroup struct { - mu *sync.Mutex - wg sync.WaitGroup - closed bool -} - -// Start a step in the output -func (f *nonInteractiveStepGroup) Add(str string, args ...interface{}) Step { - // Build our step - step := &nonInteractiveStep{mu: f.mu} - - // Setup initial status - step.Update(str, args...) - - // Grab the lock now so we can update our fields - f.mu.Lock() - defer f.mu.Unlock() - - // If we're closed we don't add this step to our waitgroup or document. - // We still create a step and return a non-nil step so downstreams don't - // crash. - if !f.closed { - // Add since we have a step - step.wg = &f.wg - f.wg.Add(1) - } - - return step -} - -func (f *nonInteractiveStepGroup) Wait() { - f.mu.Lock() - f.closed = true - wg := &f.wg - f.mu.Unlock() - - wg.Wait() -} - -type nonInteractiveStep struct { - mu *sync.Mutex - wg *sync.WaitGroup - done bool -} - -func (f *nonInteractiveStep) TermOutput() io.Writer { - return &stripAnsiWriter{Next: color.Output} -} - -func (f *nonInteractiveStep) Update(str string, args ...interface{}) { - f.mu.Lock() - defer f.mu.Unlock() - fmt.Fprintln(color.Output, "-> "+fmt.Sprintf(str, args...)) -} - -func (f *nonInteractiveStep) Status(status string) {} - -func (f *nonInteractiveStep) Done() { - f.mu.Lock() - defer f.mu.Unlock() - - if f.done { - return - } - - // Set done - f.done = true - - // Unset the waitgroup - f.wg.Done() -} - -func (f *nonInteractiveStep) Abort() { - f.Done() -} - -type stripAnsiWriter struct { - Next io.Writer -} - -func (w *stripAnsiWriter) Write(p []byte) (n int, err error) { - return w.Next.Write(reAnsi.ReplaceAll(p, []byte{})) -} - -var reAnsi = regexp.MustCompile("[\u001B\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))") diff --git a/sdk/terminal/status.go b/sdk/terminal/status.go deleted file mode 100644 index a739af7c323..00000000000 --- a/sdk/terminal/status.go +++ /dev/null @@ -1,158 +0,0 @@ -package terminal - -import ( - "context" - "fmt" - "os" - "strings" - "sync" - "time" - - "github.com/fatih/color" - "github.com/hashicorp/waypoint/internal/pkg/spinner" - "github.com/morikuni/aec" -) - -const ( - StatusOK = "ok" - StatusError = "error" - StatusWarn = "warn" - StatusTimeout = "timeout" - StatusAbort = "abort" -) - -var emojiStatus = map[string]string{ - StatusOK: "\u2713", - StatusError: "❌", - StatusWarn: "⚠️", - StatusTimeout: "⌛", -} - -var textStatus = map[string]string{ - StatusOK: " +", - StatusError: " !", - StatusWarn: " *", - StatusTimeout: "<>", -} - -var colorStatus = map[string][]aec.ANSI{ - StatusOK: {aec.GreenF}, - StatusError: {aec.RedF}, - StatusWarn: {aec.YellowF}, -} - -// Status is used to provide an updating status to the user. The status -// usually has some animated element along with it such as a spinner. -type Status interface { - // Update writes a new status. This should be a single line. - Update(msg string) - - // Indicate that a step has finished, confering an ok, error, or warn upon - // it's finishing state. If the status is not StatusOK, StatusError, or StatusWarn - // then the status text is written directly to the output, allowing for custom - // statuses. - Step(status, msg string) - - // Close should be called when the live updating is complete. The - // status will be cleared from the line. - Close() error -} - -// spinnerStatus implements Status and uses a spinner to show updates. -type spinnerStatus struct { - mu sync.Mutex - spinner *spinner.Spinner - running bool -} - -var statusIcons map[string]string - -const envForceEmoji = "WAYPOINT_FORCE_EMOJI" - -func init() { - if os.Getenv(envForceEmoji) != "" || strings.Contains(os.Getenv("LANG"), "UTF-8") { - statusIcons = emojiStatus - } else { - statusIcons = textStatus - } -} - -func newSpinnerStatus(ctx context.Context) *spinnerStatus { - return &spinnerStatus{ - spinner: spinner.New( - ctx, - spinner.CharSets[11], - time.Second/6, - spinner.WithColor("bold"), - ), - } -} - -func (s *spinnerStatus) Update(msg string) { - s.mu.Lock() - defer s.mu.Unlock() - - s.spinner.Suffix = " " + msg - - if !s.running { - s.spinner.Start() - s.running = true - } -} - -func (s *spinnerStatus) Step(status, msg string) { - s.mu.Lock() - defer s.mu.Unlock() - - s.spinner.Stop() - s.running = false - - pad := "" - - statusIcon := emojiStatus[status] - if statusIcon == "" { - statusIcon = status - } else if status == StatusWarn { - pad = " " - } - - fmt.Fprintf(color.Output, "%s%s %s\n", statusIcon, pad, msg) -} - -func (s *spinnerStatus) Close() error { - s.mu.Lock() - defer s.mu.Unlock() - - if s.running { - s.running = false - s.spinner.Suffix = "" - } - - s.spinner.Stop() - - return nil -} - -func (s *spinnerStatus) Pause() bool { - s.mu.Lock() - defer s.mu.Unlock() - - wasRunning := s.running - - if s.running { - s.running = false - s.spinner.Stop() - } - - return wasRunning -} - -func (s *spinnerStatus) Start() { - s.mu.Lock() - defer s.mu.Unlock() - - if !s.running { - s.running = true - s.spinner.Start() - } -} diff --git a/sdk/terminal/step.go b/sdk/terminal/step.go deleted file mode 100644 index bd3c8fd1608..00000000000 --- a/sdk/terminal/step.go +++ /dev/null @@ -1,129 +0,0 @@ -package terminal - -import ( - "context" - "io" -) - -const ( - TermRows = 10 - TermColumns = 100 -) - -// fancyStepGroup implements StepGroup with live updating and a display -// "window" for live terminal output (when using TermOutput). -type fancyStepGroup struct { - ctx context.Context - cancel func() - - display *Display - - steps int - done chan struct{} -} - -// Start a step in the output -func (f *fancyStepGroup) Add(str string, args ...interface{}) Step { - f.steps++ - - ent := f.display.NewStatus(0) - - ent.StartSpinner() - ent.Update(str, args...) - - return &fancyStep{ - sg: f, - ent: ent, - } -} - -func (f *fancyStepGroup) Wait() { - if f.steps > 0 { - loop: - for { - select { - case <-f.done: - f.steps-- - - if f.steps <= 0 { - break loop - } - case <-f.ctx.Done(): - break loop - } - } - } - - f.cancel() - - f.display.Close() -} - -type fancyStep struct { - sg *fancyStepGroup - ent *DisplayEntry - - done bool - status string - - term *Term -} - -func (f *fancyStep) TermOutput() io.Writer { - if f.term == nil { - t, err := NewTerm(f.sg.ctx, f.ent, TermRows, TermColumns) - if err != nil { - panic(err) - } - - f.term = t - } - - return f.term -} - -func (f *fancyStep) Update(str string, args ...interface{}) { - f.ent.Update(str, args...) -} - -func (f *fancyStep) Status(status string) { - f.status = status - f.ent.SetStatus(status) -} - -func (f *fancyStep) Done() { - if f.done { - return - } - - if f.status == "" { - f.Status(StatusOK) - } - - f.signalDone() -} - -func (f *fancyStep) Abort() { - if f.done { - return - } - - f.Status(StatusError) - f.signalDone() -} - -func (f *fancyStep) signalDone() { - f.done = true - f.ent.StopSpinner() - - // We don't want to block here because Wait might not yet have been - // called. So instead we just spawn the wait update in a goroutine - // that can also be cancaled by the context. - go func() { - select { - case f.sg.done <- struct{}{}: - case <-f.sg.ctx.Done(): - return - } - }() -} diff --git a/sdk/terminal/table.go b/sdk/terminal/table.go deleted file mode 100644 index a2bcb7b7967..00000000000 --- a/sdk/terminal/table.go +++ /dev/null @@ -1,84 +0,0 @@ -package terminal - -import ( - "github.com/fatih/color" - "github.com/olekukonko/tablewriter" -) - -// Passed to UI.Table to provide a nicely formatted table. -type Table struct { - Headers []string - Rows [][]TableEntry -} - -// Table creates a new Table structure that can be used with UI.Table. -func NewTable(headers ...string) *Table { - return &Table{ - Headers: headers, - } -} - -// TableEntry is a single entry for a table. -type TableEntry struct { - Value string - Color string -} - -// Rich adds a row to the table. -func (t *Table) Rich(cols []string, colors []string) { - var row []TableEntry - - for i, col := range cols { - if i < len(colors) { - row = append(row, TableEntry{Value: col, Color: colors[i]}) - } else { - row = append(row, TableEntry{Value: col}) - } - } - - t.Rows = append(t.Rows, row) -} - -// Table implements UI -func (u *basicUI) Table(tbl *Table, opts ...Option) { - // Build our config and set our options - cfg := &config{Writer: color.Output} - for _, opt := range opts { - opt(cfg) - } - - table := tablewriter.NewWriter(cfg.Writer) - table.SetHeader(tbl.Headers) - table.SetBorder(false) - table.SetAutoWrapText(false) - - for _, row := range tbl.Rows { - colors := make([]tablewriter.Colors, len(row)) - entries := make([]string, len(row)) - - for i, ent := range row { - entries[i] = ent.Value - - color, ok := colorMapping[ent.Color] - if ok { - colors[i] = tablewriter.Colors{color} - } - } - - table.Rich(entries, colors) - } - - table.Render() -} - -const ( - Yellow = "yellow" - Green = "green" - Red = "red" -) - -var colorMapping = map[string]int{ - Green: tablewriter.FgGreenColor, - Yellow: tablewriter.FgYellowColor, - Red: tablewriter.FgRedColor, -} diff --git a/sdk/terminal/ui.go b/sdk/terminal/ui.go deleted file mode 100644 index 801757caf0f..00000000000 --- a/sdk/terminal/ui.go +++ /dev/null @@ -1,205 +0,0 @@ -package terminal - -import ( - "errors" - "fmt" - "io" - - "github.com/fatih/color" -) - -// ErrNonInteractive is returned when Input is called on a non-Interactive UI. -var ErrNonInteractive = errors.New("noninteractive UI doesn't support this operation") - -// Passed to UI.NamedValues to provide a nicely formatted key: value output -type NamedValue struct { - Name string - Value interface{} -} - -// UI is the primary interface for interacting with a user via the CLI. -// -// Some of the methods on this interface return values that have a lifetime -// such as Status and StepGroup. While these are still active (haven't called -// the close or equivalent method on these values), no other method on the -// UI should be called. -type UI interface { - // Input asks the user for input. This will immediately return an error - // if the UI doesn't support interaction. You can test for interaction - // ahead of time with Interactive(). - Input(*Input) (string, error) - - // Interactive returns true if this prompt supports user interaction. - // If this is false, Input will always error. - Interactive() bool - - // Output outputs a message directly to the terminal. The remaining - // arguments should be interpolations for the format string. After the - // interpolations you may add Options. - Output(string, ...interface{}) - - // Output data as a table of data. Each entry is a row which will be output - // with the columns lined up nicely. - NamedValues([]NamedValue, ...Option) - - // OutputWriters returns stdout and stderr writers. These are usually - // but not always TTYs. This is useful for subprocesses, network requests, - // etc. Note that writing to these is not thread-safe by default so - // you must take care that there is only ever one writer. - OutputWriters() (stdout, stderr io.Writer, err error) - - // Status returns a live-updating status that can be used for single-line - // status updates that typically have a spinner or some similar style. - // While a Status is live (Close isn't called), other methods on UI should - // NOT be called. - Status() Status - - // Table outputs the information formatted into a Table structure. - Table(*Table, ...Option) - - // StepGroup returns a value that can be used to output individual (possibly - // parallel) steps that have their own message, status indicator, spinner, and - // body. No other output mechanism (Output, Input, Status, etc.) may be - // called until the StepGroup is complete. - StepGroup() StepGroup -} - -// StepGroup is a group of steps (that may be concurrent). -type StepGroup interface { - // Start a step in the output with the arguments making up the initial message - Add(string, ...interface{}) Step - - // Wait for all steps to finish. This allows a StepGroup to be used like - // a sync.WaitGroup with each step being run in a separate goroutine. - // This must be called to properly clean up the step group. - Wait() -} - -// A Step is the unit of work within a StepGroup. This can be driven by concurrent -// goroutines safely. -type Step interface { - // The Writer has data written to it as though it was a terminal. This will appear - // as body text under the Step's message and status. - TermOutput() io.Writer - - // Change the Steps displayed message - Update(string, ...interface{}) - - // Update the status of the message. Supported values are in status.go. - Status(status string) - - // Called when the step has finished. This must be done otherwise the StepGroup - // will wait forever for it's Steps to finish. - Done() - - // Sets the status to Error and finishes the Step if it's not already done. - // This is usually done in a defer so that any return before the Done() shows - // the Step didn't completely properly. - Abort() -} - -// Interpret decomposes the msg and arguments into the message, style, and writer -func Interpret(msg string, raw ...interface{}) (string, string, io.Writer) { - // Build our args and options - var args []interface{} - var opts []Option - for _, r := range raw { - if opt, ok := r.(Option); ok { - opts = append(opts, opt) - } else { - args = append(args, r) - } - } - - // Build our message - msg = fmt.Sprintf(msg, args...) - - // Build our config and set our options - cfg := &config{Writer: color.Output} - for _, opt := range opts { - opt(cfg) - } - - return msg, cfg.Style, cfg.Writer -} - -const ( - HeaderStyle = "header" - ErrorStyle = "error" - ErrorBoldStyle = "error-bold" - WarningStyle = "warning" - WarningBoldStyle = "warning-bold" - InfoStyle = "info" - SuccessStyle = "success" - SuccessBoldStyle = "success-bold" -) - -type config struct { - // Writer is where the message will be written to. - Writer io.Writer - - // The style the output should take on - Style string -} - -// Option controls output styling. -type Option func(*config) - -// WithHeaderStyle styles the output like a header denoting a new section -// of execution. This should only be used with single-line output. Multi-line -// output will not look correct. -func WithHeaderStyle() Option { - return func(c *config) { - c.Style = HeaderStyle - } -} - -// WithInfoStyle styles the output like it's formatted information. -func WithInfoStyle() Option { - return func(c *config) { - c.Style = InfoStyle - } -} - -// WithErrorStyle styles the output as an error message. -func WithErrorStyle() Option { - return func(c *config) { - c.Style = ErrorStyle - } -} - -// WithWarningStyle styles the output as an error message. -func WithWarningStyle() Option { - return func(c *config) { - c.Style = WarningStyle - } -} - -// WithSuccessStyle styles the output as a success message. -func WithSuccessStyle() Option { - return func(c *config) { - c.Style = SuccessStyle - } -} - -func WithStyle(style string) Option { - return func(c *config) { - c.Style = style - } -} - -// WithWriter specifies the writer for the output. -func WithWriter(w io.Writer) Option { - return func(c *config) { c.Writer = w } -} - -var ( - colorHeader = color.New(color.Bold) - colorInfo = color.New() - colorError = color.New(color.FgRed) - colorErrorBold = color.New(color.FgRed, color.Bold) - colorSuccess = color.New(color.FgGreen) - colorSuccessBold = color.New(color.FgGreen, color.Bold) - colorWarning = color.New(color.FgYellow) - colorWarningBold = color.New(color.FgYellow, color.Bold) -) diff --git a/sdk/terminal/ui_test.go b/sdk/terminal/ui_test.go deleted file mode 100644 index f2ca8ca5cba..00000000000 --- a/sdk/terminal/ui_test.go +++ /dev/null @@ -1,84 +0,0 @@ -package terminal - -import ( - "bytes" - "strings" - "testing" - - "github.com/stretchr/testify/require" -) - -func TestNamedValues(t *testing.T) { - require := require.New(t) - - var buf bytes.Buffer - var ui basicUI - ui.NamedValues([]NamedValue{ - {"hello", "a"}, - {"this", "is"}, - {"a", "test"}, - {"of", "foo"}, - {"the_key_value", "style"}, - }, - WithWriter(&buf), - ) - - expected := ` - hello: a - this: is - a: test - of: foo - the_key_value: style - -` - - require.Equal(strings.TrimLeft(expected, "\n"), buf.String()) -} - -func TestNamedValues_server(t *testing.T) { - require := require.New(t) - - var buf bytes.Buffer - var ui basicUI - ui.Output("Server configuration:", WithHeaderStyle(), WithWriter(&buf)) - ui.NamedValues([]NamedValue{ - {"DB Path", "data.db"}, - {"gRPC Address", "127.0.0.1:1234"}, - {"HTTP Address", "127.0.0.1:1235"}, - {"URL Service", "api.alpha.waypoint.run:443 (account: token)"}, - }, - WithWriter(&buf), - ) - - expected := ` -==> Server configuration: - DB Path: data.db - gRPC Address: 127.0.0.1:1234 - HTTP Address: 127.0.0.1:1235 - URL Service: api.alpha.waypoint.run:443 (account: token) - -` - - require.Equal(expected, buf.String()) -} - -func TestStatusStyle(t *testing.T) { - require := require.New(t) - - var buf bytes.Buffer - var ui basicUI - ui.Output(strings.TrimSpace(` -one -two - three`), - WithWriter(&buf), - WithInfoStyle(), - ) - - expected := ` one - two - three -` - - require.Equal(expected, buf.String()) -}