From 9baacbc44ed3e97d2179f678d8a99b0e8ddf98d0 Mon Sep 17 00:00:00 2001 From: sophia Date: Tue, 24 Nov 2020 11:33:53 -0600 Subject: [PATCH] Add proto files --- bin/vagrant-server.rb | 2 - proto/gen/plugin_pb.rb | 252 ++++++++++++++++++++++++++++++++ proto/gen/plugin_services_pb.rb | 97 ++++++++++++ proto/gen/protostructure_pb.rb | 42 ++++++ 4 files changed, 391 insertions(+), 2 deletions(-) create mode 100644 proto/gen/plugin_pb.rb create mode 100644 proto/gen/plugin_services_pb.rb create mode 100644 proto/gen/protostructure_pb.rb diff --git a/bin/vagrant-server.rb b/bin/vagrant-server.rb index 368958104..cc46cd49e 100644 --- a/bin/vagrant-server.rb +++ b/bin/vagrant-server.rb @@ -4,8 +4,6 @@ require_relative '../proto/gen/plugin_services_pb' require 'grpc' require 'grpc/health/checker' require 'grpc/health/v1/health_services_pb' -require 'openssl' -require 'optparse' class ProviderService < Hashicorp::Vagrant::Sdk::Provider::Service def documentation(req, _unused_call) diff --git a/proto/gen/plugin_pb.rb b/proto/gen/plugin_pb.rb new file mode 100644 index 000000000..5649b3f64 --- /dev/null +++ b/proto/gen/plugin_pb.rb @@ -0,0 +1,252 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: plugin.proto + +require 'google/protobuf' + +require 'google/protobuf/any_pb' +require 'google/protobuf/empty_pb' +require 'google/rpc/status_pb' +require_relative 'protostructure_pb' +Google::Protobuf::DescriptorPool.generated_pool.build do + add_file("plugin.proto", :syntax => :proto3) do + add_message "hashicorp.vagrant.sdk.Args" do + end + add_message "hashicorp.vagrant.sdk.Args.Source" do + optional :app, :string, 1 + optional :path, :string, 2 + end + add_message "hashicorp.vagrant.sdk.Args.JobInfo" do + optional :local, :bool, 1 + optional :workspace, :string, 2 + optional :id, :string, 3 + end + add_message "hashicorp.vagrant.sdk.Args.DeploymentConfig" do + optional :id, :string, 1 + optional :server_addr, :string, 2 + optional :server_tls, :bool, 3 + optional :server_tls_skip_verify, :bool, 4 + optional :entrypoint_invite_token, :string, 5 + end + add_message "hashicorp.vagrant.sdk.Args.DataDir" do + end + add_message "hashicorp.vagrant.sdk.Args.DataDir.Project" do + optional :cache_dir, :string, 2 + optional :data_dir, :string, 3 + end + add_message "hashicorp.vagrant.sdk.Args.DataDir.App" do + optional :cache_dir, :string, 2 + optional :data_dir, :string, 3 + end + add_message "hashicorp.vagrant.sdk.Args.DataDir.Component" do + optional :cache_dir, :string, 2 + optional :data_dir, :string, 3 + end + add_message "hashicorp.vagrant.sdk.Args.Logger" do + optional :name, :string, 1 + end + add_message "hashicorp.vagrant.sdk.Args.TerminalUI" do + optional :stream_id, :uint32, 1 + end + add_message "hashicorp.vagrant.sdk.Args.ReleaseTargets" do + repeated :targets, :message, 1, "hashicorp.vagrant.sdk.Args.ReleaseTargets.Target" + end + add_message "hashicorp.vagrant.sdk.Args.ReleaseTargets.Target" do + optional :deployment, :message, 1, "google.protobuf.Any" + optional :percent, :uint32, 2 + end + add_message "hashicorp.vagrant.sdk.Args.LabelSet" do + map :labels, :string, :string, 1 + end + add_message "hashicorp.vagrant.sdk.FuncSpec" do + optional :name, :string, 1 + repeated :args, :message, 2, "hashicorp.vagrant.sdk.FuncSpec.Value" + repeated :result, :message, 3, "hashicorp.vagrant.sdk.FuncSpec.Value" + end + add_message "hashicorp.vagrant.sdk.FuncSpec.Value" do + optional :name, :string, 1 + optional :type, :string, 2 + optional :value, :message, 3, "google.protobuf.Any" + end + add_message "hashicorp.vagrant.sdk.FuncSpec.Args" do + repeated :args, :message, 1, "hashicorp.vagrant.sdk.FuncSpec.Value" + end + add_message "hashicorp.vagrant.sdk.Config" do + end + add_message "hashicorp.vagrant.sdk.Config.ConfigureRequest" do + optional :json, :bytes, 1 + end + add_message "hashicorp.vagrant.sdk.Config.StructResp" do + optional :struct, :message, 1, "protostructure.Struct" + end + add_message "hashicorp.vagrant.sdk.Config.FieldDocumentation" do + optional :name, :string, 1 + optional :synopsis, :string, 2 + optional :summary, :string, 3 + optional :optional, :bool, 4 + optional :env_var, :string, 5 + optional :type, :string, 6 + optional :default, :string, 7 + end + add_message "hashicorp.vagrant.sdk.Config.MapperDocumentation" do + optional :input, :string, 1 + optional :output, :string, 2 + optional :description, :string, 3 + end + add_message "hashicorp.vagrant.sdk.Config.Documentation" do + optional :description, :string, 1 + optional :example, :string, 2 + optional :input, :string, 3 + optional :output, :string, 4 + map :fields, :string, :message, 5, "hashicorp.vagrant.sdk.Config.FieldDocumentation" + repeated :mappers, :message, 6, "hashicorp.vagrant.sdk.Config.MapperDocumentation" + end + add_message "hashicorp.vagrant.sdk.Auth" do + end + add_message "hashicorp.vagrant.sdk.Auth.AuthResponse" do + optional :authenticated, :bool, 1 + end + add_message "hashicorp.vagrant.sdk.ImplementsResp" do + optional :implements, :bool, 1 + end + add_message "hashicorp.vagrant.sdk.TerminalUI" do + end + add_message "hashicorp.vagrant.sdk.TerminalUI.IsInteractiveResponse" do + optional :interactive, :bool, 1 + end + add_message "hashicorp.vagrant.sdk.TerminalUI.OutputRequest" do + repeated :lines, :string, 1 + end + add_message "hashicorp.vagrant.sdk.TerminalUI.Response" do + oneof :event do + optional :input, :message, 1, "hashicorp.vagrant.sdk.TerminalUI.Event.InputResp" + end + end + add_message "hashicorp.vagrant.sdk.TerminalUI.Event" do + oneof :event do + optional :line, :message, 1, "hashicorp.vagrant.sdk.TerminalUI.Event.Line" + optional :status, :message, 2, "hashicorp.vagrant.sdk.TerminalUI.Event.Status" + optional :named_values, :message, 3, "hashicorp.vagrant.sdk.TerminalUI.Event.NamedValues" + optional :raw, :message, 4, "hashicorp.vagrant.sdk.TerminalUI.Event.Raw" + optional :table, :message, 5, "hashicorp.vagrant.sdk.TerminalUI.Event.Table" + optional :step_group, :message, 6, "hashicorp.vagrant.sdk.TerminalUI.Event.StepGroup" + optional :step, :message, 7, "hashicorp.vagrant.sdk.TerminalUI.Event.Step" + optional :input, :message, 8, "hashicorp.vagrant.sdk.TerminalUI.Event.Input" + end + end + add_message "hashicorp.vagrant.sdk.TerminalUI.Event.Input" do + optional :prompt, :string, 1 + optional :style, :string, 2 + optional :secret, :bool, 3 + end + add_message "hashicorp.vagrant.sdk.TerminalUI.Event.InputResp" do + optional :input, :string, 1 + optional :error, :message, 2, "google.rpc.Status" + end + add_message "hashicorp.vagrant.sdk.TerminalUI.Event.Status" do + optional :status, :string, 1 + optional :msg, :string, 2 + optional :step, :bool, 3 + end + add_message "hashicorp.vagrant.sdk.TerminalUI.Event.Line" do + optional :msg, :string, 1 + optional :style, :string, 2 + end + add_message "hashicorp.vagrant.sdk.TerminalUI.Event.Raw" do + optional :data, :bytes, 1 + optional :stderr, :bool, 2 + end + add_message "hashicorp.vagrant.sdk.TerminalUI.Event.NamedValue" do + optional :name, :string, 1 + optional :value, :string, 2 + end + add_message "hashicorp.vagrant.sdk.TerminalUI.Event.NamedValues" do + repeated :values, :message, 1, "hashicorp.vagrant.sdk.TerminalUI.Event.NamedValue" + end + add_message "hashicorp.vagrant.sdk.TerminalUI.Event.TableEntry" do + optional :value, :string, 1 + optional :color, :string, 2 + end + add_message "hashicorp.vagrant.sdk.TerminalUI.Event.TableRow" do + repeated :entries, :message, 1, "hashicorp.vagrant.sdk.TerminalUI.Event.TableEntry" + end + add_message "hashicorp.vagrant.sdk.TerminalUI.Event.Table" do + repeated :headers, :string, 1 + repeated :rows, :message, 2, "hashicorp.vagrant.sdk.TerminalUI.Event.TableRow" + end + add_message "hashicorp.vagrant.sdk.TerminalUI.Event.StepGroup" do + optional :close, :bool, 1 + end + add_message "hashicorp.vagrant.sdk.TerminalUI.Event.Step" do + optional :id, :int32, 1 + optional :close, :bool, 2 + optional :msg, :string, 3 + optional :status, :string, 4 + optional :output, :bytes, 5 + end + add_message "hashicorp.vagrant.sdk.Map" do + end + add_message "hashicorp.vagrant.sdk.Map.Request" do + optional :args, :message, 1, "hashicorp.vagrant.sdk.FuncSpec.Args" + optional :result, :string, 2 + end + add_message "hashicorp.vagrant.sdk.Map.Response" do + optional :result, :message, 1, "google.protobuf.Any" + end + add_message "hashicorp.vagrant.sdk.Map.ListResponse" do + repeated :funcs, :message, 1, "hashicorp.vagrant.sdk.FuncSpec" + end + end +end + +module Hashicorp + module Vagrant + module Sdk + Args = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args").msgclass + Args::Source = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.Source").msgclass + Args::JobInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.JobInfo").msgclass + Args::DeploymentConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.DeploymentConfig").msgclass + Args::DataDir = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.DataDir").msgclass + Args::DataDir::Project = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.DataDir.Project").msgclass + Args::DataDir::App = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.DataDir.App").msgclass + Args::DataDir::Component = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.DataDir.Component").msgclass + Args::Logger = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.Logger").msgclass + Args::TerminalUI = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.TerminalUI").msgclass + Args::ReleaseTargets = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.ReleaseTargets").msgclass + Args::ReleaseTargets::Target = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.ReleaseTargets.Target").msgclass + Args::LabelSet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.LabelSet").msgclass + FuncSpec = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.FuncSpec").msgclass + FuncSpec::Value = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.FuncSpec.Value").msgclass + FuncSpec::Args = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.FuncSpec.Args").msgclass + Config = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Config").msgclass + Config::ConfigureRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Config.ConfigureRequest").msgclass + Config::StructResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Config.StructResp").msgclass + Config::FieldDocumentation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Config.FieldDocumentation").msgclass + Config::MapperDocumentation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Config.MapperDocumentation").msgclass + Config::Documentation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Config.Documentation").msgclass + Auth = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Auth").msgclass + Auth::AuthResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Auth.AuthResponse").msgclass + ImplementsResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.ImplementsResp").msgclass + TerminalUI = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.TerminalUI").msgclass + TerminalUI::IsInteractiveResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.TerminalUI.IsInteractiveResponse").msgclass + TerminalUI::OutputRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.TerminalUI.OutputRequest").msgclass + TerminalUI::Response = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.TerminalUI.Response").msgclass + TerminalUI::Event = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.TerminalUI.Event").msgclass + TerminalUI::Event::Input = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.TerminalUI.Event.Input").msgclass + TerminalUI::Event::InputResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.TerminalUI.Event.InputResp").msgclass + TerminalUI::Event::Status = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.TerminalUI.Event.Status").msgclass + TerminalUI::Event::Line = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.TerminalUI.Event.Line").msgclass + TerminalUI::Event::Raw = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.TerminalUI.Event.Raw").msgclass + TerminalUI::Event::NamedValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.TerminalUI.Event.NamedValue").msgclass + TerminalUI::Event::NamedValues = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.TerminalUI.Event.NamedValues").msgclass + TerminalUI::Event::TableEntry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.TerminalUI.Event.TableEntry").msgclass + TerminalUI::Event::TableRow = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.TerminalUI.Event.TableRow").msgclass + TerminalUI::Event::Table = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.TerminalUI.Event.Table").msgclass + TerminalUI::Event::StepGroup = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.TerminalUI.Event.StepGroup").msgclass + TerminalUI::Event::Step = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.TerminalUI.Event.Step").msgclass + Map = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Map").msgclass + Map::Request = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Map.Request").msgclass + Map::Response = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Map.Response").msgclass + Map::ListResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Map.ListResponse").msgclass + end + end +end diff --git a/proto/gen/plugin_services_pb.rb b/proto/gen/plugin_services_pb.rb new file mode 100644 index 000000000..0342d9d1b --- /dev/null +++ b/proto/gen/plugin_services_pb.rb @@ -0,0 +1,97 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: plugin.proto for package 'hashicorp.vagrant.sdk' + +require 'grpc' +require_relative 'plugin_pb' + +module Hashicorp + module Vagrant + module Sdk + module TerminalUIService + # ******************************************************************* + # Terminal UI Service + # ****************************************************************** + # + # 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. + class Service + + include GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'hashicorp.vagrant.sdk.TerminalUIService' + + rpc :Output, ::Hashicorp::Vagrant::Sdk::TerminalUI::OutputRequest, ::Google::Protobuf::Empty + rpc :Events, stream(::Hashicorp::Vagrant::Sdk::TerminalUI::Event), stream(::Hashicorp::Vagrant::Sdk::TerminalUI::Response) + rpc :IsInteractive, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::TerminalUI::IsInteractiveResponse + end + + Stub = Service.rpc_stub_class + end + module Mapper + # Mapper is a specialized type of plugin that provides type mappers + # to convert to/from various types. + class Service + + include GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'hashicorp.vagrant.sdk.Mapper' + + # ListMappers returns the list of mappers that this plugin supports. + rpc :ListMappers, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::Map::ListResponse + # Map executes a mapper. + rpc :Map, ::Hashicorp::Vagrant::Sdk::Map::Request, ::Hashicorp::Vagrant::Sdk::Map::Response + end + + Stub = Service.rpc_stub_class + end + module Provider + # ******************************************************************* + # Provider Plugin Service + # ****************************************************************** + # + # Provider service is a provider that takes some set of arguments changes + # the state of a machine + class Service + + include GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'hashicorp.vagrant.sdk.Provider' + + rpc :ConfigStruct, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::Config::StructResp + rpc :Configure, ::Hashicorp::Vagrant::Sdk::Config::ConfigureRequest, ::Google::Protobuf::Empty + rpc :Documentation, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::Config::Documentation + end + + Stub = Service.rpc_stub_class + end + module Provisioner + # ******************************************************************* + # Provisioner Plugin Service + # ****************************************************************** + # + # A Provisioner runs actions against a VM + class Service + + include GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'hashicorp.vagrant.sdk.Provisioner' + + rpc :ConfigStruct, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::Config::StructResp + rpc :Configure, ::Hashicorp::Vagrant::Sdk::Config::ConfigureRequest, ::Google::Protobuf::Empty + rpc :Documentation, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::Config::Documentation + end + + Stub = Service.rpc_stub_class + end + end + end +end diff --git a/proto/gen/protostructure_pb.rb b/proto/gen/protostructure_pb.rb new file mode 100644 index 000000000..9b2a9c0c1 --- /dev/null +++ b/proto/gen/protostructure_pb.rb @@ -0,0 +1,42 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: protostructure.proto + +require 'google/protobuf' + +Google::Protobuf::DescriptorPool.generated_pool.build do + add_file("protostructure.proto", :syntax => :proto3) do + add_message "protostructure.Struct" do + repeated :fields, :message, 1, "protostructure.Struct.Field" + end + add_message "protostructure.Struct.Field" do + optional :Name, :string, 1 + optional :PkgPath, :string, 2 + optional :Tag, :string, 3 + optional :type, :message, 4, "protostructure.Type" + end + add_message "protostructure.Type" do + oneof :type do + optional :primitive, :message, 1, "protostructure.Primitive" + optional :container, :message, 2, "protostructure.Container" + optional :struct, :message, 3, "protostructure.Struct" + end + end + add_message "protostructure.Primitive" do + optional :kind, :uint32, 1 + end + add_message "protostructure.Container" do + optional :kind, :uint32, 1 + optional :elem, :message, 2, "protostructure.Type" + optional :key, :message, 3, "protostructure.Type" + optional :count, :int32, 4 + end + end +end + +module Protostructure + Struct = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("protostructure.Struct").msgclass + Struct::Field = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("protostructure.Struct.Field").msgclass + Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("protostructure.Type").msgclass + Primitive = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("protostructure.Primitive").msgclass + Container = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("protostructure.Container").msgclass +end