From addf420ca284edd28d61df02cb41c1d8fe81ed48 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Wed, 9 Dec 2020 14:43:53 -0800 Subject: [PATCH] Add some helper methods and some adjustments to serve setup --- lib/vagrant/registry.rb | 9 + plugins/commands/serve/command.rb | 29 +- .../commands/serve/service/command_service.rb | 63 +++ .../commands/serve/service/host_service.rb | 22 + .../serve/service/internal_service.rb | 28 ++ .../commands/serve/service/plugin_service.rb | 33 +- .../serve/service/proto/gen/core_pb.rb | 231 ++++++++++ .../service/proto/gen/core_services_pb.rb | 40 ++ .../serve/service/proto/gen/plugin_pb.rb | 408 ++++++++++++++++++ .../service/proto/gen/plugin_services_pb.rb | 264 ++++++++++++ .../service/proto/gen/protostructure_pb.rb | 42 ++ 11 files changed, 1142 insertions(+), 27 deletions(-) create mode 100644 plugins/commands/serve/service/command_service.rb create mode 100644 plugins/commands/serve/service/host_service.rb create mode 100644 plugins/commands/serve/service/internal_service.rb create mode 100644 plugins/commands/serve/service/proto/gen/core_pb.rb create mode 100644 plugins/commands/serve/service/proto/gen/core_services_pb.rb create mode 100644 plugins/commands/serve/service/proto/gen/plugin_pb.rb create mode 100644 plugins/commands/serve/service/proto/gen/plugin_services_pb.rb create mode 100644 plugins/commands/serve/service/proto/gen/protostructure_pb.rb diff --git a/lib/vagrant/registry.rb b/lib/vagrant/registry.rb index c0c4e1bad..27f6154cd 100644 --- a/lib/vagrant/registry.rb +++ b/lib/vagrant/registry.rb @@ -50,6 +50,15 @@ module Vagrant end end + # Iterate over the keyspace and return result + # + # @return [Array] + def map(&block) + @items.map do |key, _| + yield key, get(key) + end + end + # Return the number of elements in this registry. # # @return [Integer] diff --git a/plugins/commands/serve/command.rb b/plugins/commands/serve/command.rb index 806c8bde5..2acdc3bc2 100644 --- a/plugins/commands/serve/command.rb +++ b/plugins/commands/serve/command.rb @@ -1,5 +1,16 @@ +# NOTE: Update the load path so the proto files can properly require dependencies +$LOAD_PATH << File.expand_path("../service/proto/gen", __FILE__) + +require_relative './service/proto/gen/ruby-server_pb' +require_relative './service/proto/gen/ruby-server_services_pb' +require_relative './service/proto/gen/plugin_pb' +require_relative './service/proto/gen/plugin_services_pb' + require_relative "./service/plugin_service" require_relative "./service/provider_service" +require_relative "./service/command_service" +require_relative "./service/host_service" +require_relative "./service/internal_service" require "optparse" require 'grpc' @@ -17,7 +28,7 @@ module VagrantPlugins end def execute - options = {} + options = {port: DEFAULT_PORT} opts = OptionParser.new do |o| o.banner = "Usage: vagrant serve" @@ -33,7 +44,6 @@ module VagrantPlugins # Parse the options argv = parse_options(opts) return if !argv - options[:port] ||= DEFAULT_PORT serve(options[:port]) end @@ -43,17 +53,24 @@ module VagrantPlugins s = GRPC::RpcServer.new # Listen on port 10001 on all interfaces. Update for production use. s.add_http2_port("[::]:#{port}", :this_port_is_insecure) - + s.handle(VagrantPlugins::CommandServe::Serve::PluginService.new) s.handle(VagrantPlugins::CommandServe::Serve::ProviderService.new) + s.handle(Service::InternalService.new) + s.handle(Service::HostService.new) - health_checker = Grpc::Health::Checker.new health_checker.add_status( - "Service::PluginService", + Service::InternalService, + Grpc::Health::V1::HealthCheckResponse::ServingStatus::SERVING) + health_checker.add_status( + Service::HostService, + Grpc::Health::V1::HealthCheckResponse::ServingStatus::SERVING) + health_checker.add_status( + Service::CommandService, Grpc::Health::V1::HealthCheckResponse::ServingStatus::SERVING) s.handle(health_checker) - + STDOUT.puts "1|1|tcp|127.0.0.1:#{port}|grpc" STDOUT.flush s.run_till_terminated_or_interrupted([1, 'int', 'SIGQUIT', 'SIGINT']) diff --git a/plugins/commands/serve/service/command_service.rb b/plugins/commands/serve/service/command_service.rb new file mode 100644 index 000000000..f884602d6 --- /dev/null +++ b/plugins/commands/serve/service/command_service.rb @@ -0,0 +1,63 @@ +module VagrantPlugins + module CommandServe + module Service + class CommandService < Hashicorp::Vagrant::Sdk::CommandService::Service + def help_spec(*args) + Hashicorp::Vagrant::Sdk::FuncSpec.new + end + + def help(*args) + plugin_name = args.last.metadata["plugin_name"] + plugin = Vagrant::Plugin::V2::Plugin.manager.commands[plugin_name.to_sym].to_a.first + if !plugin + raise "Failed to locate command plugin for: #{plugin_name}" + end + # klass = plugin.call + Hashicorp::Vagrant::Sdk::Command::HelpResp.new( + help: "No help information configured" + ) + end + + def synopsis_spec(*args) + Hashicorp::Vagrant::Sdk::FuncSpec.new( + name: "synopsis", + result: [ + Hashicorp::Vagrant::Sdk::FuncSpec::Value.new( + type: "hashicorp.vagrant.sdk.Command.SynopsisResp", + name: "" + ) + ] + ) + end + + def synopsis(*args) + plugin_name = args.last.metadata["plugin_name"] + plugin = Vagrant::Plugin::V2::Plugin.manager.commands[plugin_name.to_sym].to_a.first + if !plugin + raise "Failed to locate command plugin for: #{plugin_name}" + end + klass = plugin.call + Hashicorp::Vagrant::Sdk::Command::SynopsisResp.new( + synopsis: klass.synopsis + ) + end + + def flags_spec(*args) + Hashicorp::Vagrant::Sdk::FuncSpec.new + end + + def flags(*args) + plugin_name = args.last.metadata["plugin_name"] + plugin = Vagrant::Plugin::V2::Plugin.manager.commands[plugin_name.to_sym].to_a.first + if !plugin + raise "Failed to locate command plugin for: #{plugin_name}" + end + # klass = plugin.call + Hashicorp::Vagrant::Sdk::Command::FlagsResp.new( + flags: "not implemented" + ) + end + end + end + end +end diff --git a/plugins/commands/serve/service/host_service.rb b/plugins/commands/serve/service/host_service.rb new file mode 100644 index 000000000..14a938a3d --- /dev/null +++ b/plugins/commands/serve/service/host_service.rb @@ -0,0 +1,22 @@ +module VagrantPlugins + module CommandServe + module Service + class HostService < Hashicorp::Vagrant::Sdk::HostService::Service + def detect_spec(*args) + Hashicorp::Vagrant::Sdk::FuncSpec.new + end + + def detect(*args) + plugin_name = args.last.metadata["plugin_name"] + plugin = Vagrant::Plugin::V2::Plugin.manager.hosts[plugin_name.to_sym].to_a.first + if !plugin + raise "Failed to locate host plugin for: #{plugin_name}" + end + Hashicorp::Vagrant::Sdk::Host::DetectResp.new( + detected: plugin.new.detect?({}) + ) + end + end + end + end +end diff --git a/plugins/commands/serve/service/internal_service.rb b/plugins/commands/serve/service/internal_service.rb new file mode 100644 index 000000000..6b890a63d --- /dev/null +++ b/plugins/commands/serve/service/internal_service.rb @@ -0,0 +1,28 @@ +require "vagrant/plugin/v2/plugin" + +module VagrantPlugins + module CommandServe + module Service + class InternalService < Hashicorp::Vagrant::RubyVagrant::Service + def get_plugins(req, _unused_call) + plugins = [] + plugin_manager = Vagrant::Plugin::V2::Plugin.manager + plugins = [[:commands, :COMMAND], + [:communicators, :COMMUNICATOR], + [:guests, :GUEST], + [:hosts, :HOST], + [:providers, :PROVIDER], + [:provisioners, :PROVISIONER], + [:synced_folders, :SYNCED_FOLDER]].map do |method, const| + plugin_manager.send(method).map do |k, v| + Hashicorp::Vagrant::Plugin.new(name: k, type: Hashicorp::Vagrant::Plugin::Type.const_get(const)) + end + end.flatten + Hashicorp::Vagrant::GetPluginsResponse.new( + plugins: plugins + ) + end + end + end + end +end diff --git a/plugins/commands/serve/service/plugin_service.rb b/plugins/commands/serve/service/plugin_service.rb index 7c166c130..87d9c35a6 100644 --- a/plugins/commands/serve/service/plugin_service.rb +++ b/plugins/commands/serve/service/plugin_service.rb @@ -1,5 +1,6 @@ require "vagrant/plugin/v2/plugin" + require 'vagrant/proto/gen/ruby-server_pb' require 'vagrant/proto/gen/ruby-server_services_pb' @@ -10,27 +11,17 @@ module VagrantPlugins def get_plugins(req, _unused_call) plugins = [] plugin_manager = Vagrant::Plugin::V2::Plugin.manager - plugin_manager.commands.each do |k, v| - plugins << Hashicorp::Vagrant::Plugin.new(name: k, type: Hashicorp::Vagrant::Plugin::Type::COMMAND ) - end - plugin_manager.communicators.each do |k, v| - plugins << Hashicorp::Vagrant::Plugin.new(name: k, type: Hashicorp::Vagrant::Plugin::Type::COMMUNICATOR ) - end - plugin_manager.guests.each do |k, v| - plugins << Hashicorp::Vagrant::Plugin.new(name: k, type: Hashicorp::Vagrant::Plugin::Type::GUEST ) - end - plugin_manager.hosts.each do |k, v| - plugins << Hashicorp::Vagrant::Plugin.new(name: k, type: Hashicorp::Vagrant::Plugin::Type::HOST ) - end - plugin_manager.providers.each do |k, v| - plugins << Hashicorp::Vagrant::Plugin.new(name: k, type: Hashicorp::Vagrant::Plugin::Type::PROVIDER ) - end - plugin_manager.provisioners.each do |k, v| - plugins << Hashicorp::Vagrant::Plugin.new(name: k, type: Hashicorp::Vagrant::Plugin::Type::PROVISIONER ) - end - plugin_manager.synced_folders.each do |k, v| - plugins << Hashicorp::Vagrant::Plugin.new(name: k, type: Hashicorp::Vagrant::Plugin::Type::SYNCED_FOLDER ) - end + plugins = [[:commands, :COMMAND], + [:communicators, :COMMUNICATOR], + [:guests, :GUEST], + [:hosts, :HOST], + [:providers, :PROVIDER], + [:provisioners, :PROVISIONER], + [:synced_folders, :SYNCED_FOLDER]].map do |method, const| + plugin_manager.send(method).map do |k, v| + Hashicorp::Vagrant::Plugin.new(name: k, type: Hashicorp::Vagrant::Plugin::Type.const_get(const)) + end + end.flatten Hashicorp::Vagrant::GetPluginsResponse.new( plugins: plugins ) diff --git a/plugins/commands/serve/service/proto/gen/core_pb.rb b/plugins/commands/serve/service/proto/gen/core_pb.rb new file mode 100644 index 000000000..0a394dff8 --- /dev/null +++ b/plugins/commands/serve/service/proto/gen/core_pb.rb @@ -0,0 +1,231 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: core.proto + +require 'google/protobuf' + +require 'plugin_pb' +require 'google/protobuf/any_pb' +require 'google/protobuf/timestamp_pb' +Google::Protobuf::DescriptorPool.generated_pool.build do + add_file("core.proto", :syntax => :proto3) do + add_message "hashicorp.vagrant.sdk.StateBag" do + map :data, :string, :message, 1, "hashicorp.vagrant.sdk.StateBag.Value" + end + add_message "hashicorp.vagrant.sdk.StateBag.Value" do + oneof :value do + optional :text, :string, 1 + optional :map, :message, 2, "google.protobuf.Any" + end + end + add_message "hashicorp.vagrant.sdk.LabelSet" do + map :labels, :string, :string, 1 + end + add_message "hashicorp.vagrant.sdk.Options" do + optional :opt, :message, 1, "hashicorp.vagrant.sdk.LabelSet" + end + add_message "hashicorp.vagrant.sdk.SSHInfo" do + optional :host, :string, 1 + optional :port, :string, 2 + optional :private_key_path, :string, 3 + optional :keys_only, :bool, 4 + optional :verify_host_key, :bool, 5 + optional :username, :string, 6 + optional :remote_user, :string, 7 + optional :compression, :bool, 8 + optional :dsa_authentication, :bool, 9 + optional :config, :string, 10 + repeated :extra_args, :string, 11 + optional :forward_agent, :bool, 12 + optional :forward_x11, :bool, 13 + repeated :forward_env, :string, 14 + optional :connect_timeout, :int64, 15 + optional :ssh_command, :string, 16 + optional :proxy_command, :string, 17 + end + add_message "hashicorp.vagrant.sdk.WinrmInfo" do + optional :username, :string, 1 + optional :password, :string, 2 + optional :host, :string, 3 + optional :port, :int64, 4 + optional :guest_port, :int64, 5 + optional :max_tries, :int64, 6 + optional :retry_delay, :int64, 7 + optional :timeout, :int64, 8 + optional :transport, :enum, 9, "hashicorp.vagrant.sdk.WinrmInfo.Transport" + optional :ssl_peer_verification, :bool, 10 + optional :execution_time_limit, :string, 11 + optional :basic_auth_only, :bool, 12 + optional :codepage, :string, 13 + end + add_enum "hashicorp.vagrant.sdk.WinrmInfo.Transport" do + value :NEGOTIATE, 0 + value :SSL, 1 + value :PLAINTEXT, 2 + end + add_message "hashicorp.vagrant.sdk.MachineState" do + optional :id, :string, 1 + optional :short_description, :string, 2 + optional :long_description, :string, 3 + end + add_message "hashicorp.vagrant.sdk.MachineIndex" do + end + add_message "hashicorp.vagrant.sdk.MachineIndex.Entry" do + optional :id, :string, 1 + optional :local_data_path, :string, 2 + optional :name, :string, 3 + optional :provider, :string, 4 + optional :state, :string, 5 + optional :vagrantfile_name, :string, 6 + optional :vagrantfile_path, :string, 7 + optional :updated_at, :string, 8 + optional :extra_data, :message, 9, "hashicorp.vagrant.sdk.Options" + end + add_message "hashicorp.vagrant.sdk.BoxCollection" do + optional :directory, :string, 1 + end + add_message "hashicorp.vagrant.sdk.Box" do + optional :name, :string, 1 + optional :provider, :string, 2 + optional :version, :string, 3 + optional :directory, :string, 4 + optional :metadata, :message, 5, "hashicorp.vagrant.sdk.Options" + optional :metadata_url, :string, 6 + end + add_message "hashicorp.vagrant.sdk.Environment" do + end + add_message "hashicorp.vagrant.sdk.MachineProvider" do + end + add_message "hashicorp.vagrant.sdk.Configuration" do + end + add_message "hashicorp.vagrant.sdk.Vagrantfile" do + end + add_message "hashicorp.vagrant.sdk.Ref" do + end + add_message "hashicorp.vagrant.sdk.Ref.Machine" do + optional :resource_id, :string, 1 + end + add_message "hashicorp.vagrant.sdk.Machine" do + end + add_message "hashicorp.vagrant.sdk.Machine.SetNameRequest" do + optional :machine, :message, 1, "hashicorp.vagrant.sdk.Ref.Machine" + optional :name, :string, 2 + end + add_message "hashicorp.vagrant.sdk.Machine.SetNameResponse" do + end + add_message "hashicorp.vagrant.sdk.Machine.GetNameRequest" do + optional :machine, :message, 1, "hashicorp.vagrant.sdk.Ref.Machine" + end + add_message "hashicorp.vagrant.sdk.Machine.GetNameResponse" do + optional :name, :string, 1 + end + add_message "hashicorp.vagrant.sdk.Machine.SetIDRequest" do + optional :machine, :message, 1, "hashicorp.vagrant.sdk.Ref.Machine" + optional :id, :string, 2 + end + add_message "hashicorp.vagrant.sdk.Machine.SetIDResponse" do + end + add_message "hashicorp.vagrant.sdk.Machine.GetIDRequest" do + optional :machine, :message, 1, "hashicorp.vagrant.sdk.Ref.Machine" + end + add_message "hashicorp.vagrant.sdk.Machine.GetIDResponse" do + optional :id, :string, 1 + end + add_message "hashicorp.vagrant.sdk.Machine.BoxRequest" do + optional :machine, :message, 1, "hashicorp.vagrant.sdk.Ref.Machine" + end + add_message "hashicorp.vagrant.sdk.Machine.BoxResponse" do + optional :box, :message, 1, "hashicorp.vagrant.sdk.Box" + end + add_message "hashicorp.vagrant.sdk.Machine.DatadirRequest" do + optional :machine, :message, 1, "hashicorp.vagrant.sdk.Ref.Machine" + end + add_message "hashicorp.vagrant.sdk.Machine.DatadirResponse" do + optional :datadir, :message, 1, "hashicorp.vagrant.sdk.Args.DataDir.Machine" + end + add_message "hashicorp.vagrant.sdk.Machine.LocalDataPathRequest" do + optional :machine, :message, 1, "hashicorp.vagrant.sdk.Ref.Machine" + end + add_message "hashicorp.vagrant.sdk.Machine.LocalDataPathResponse" do + optional :path, :string, 1 + end + add_message "hashicorp.vagrant.sdk.Machine.ProviderRequest" do + optional :machine, :message, 1, "hashicorp.vagrant.sdk.Ref.Machine" + end + add_message "hashicorp.vagrant.sdk.Machine.ProviderResponse" do + end + add_message "hashicorp.vagrant.sdk.Machine.VagrantfileNameRequest" do + optional :machine, :message, 1, "hashicorp.vagrant.sdk.Ref.Machine" + end + add_message "hashicorp.vagrant.sdk.Machine.VagrantfileNameResponse" do + optional :name, :string, 1 + end + add_message "hashicorp.vagrant.sdk.Machine.VagrantfilePathRequest" do + optional :machine, :message, 1, "hashicorp.vagrant.sdk.Ref.Machine" + end + add_message "hashicorp.vagrant.sdk.Machine.VagrantfilePathResponse" do + optional :path, :string, 1 + end + add_message "hashicorp.vagrant.sdk.Machine.UpdatedAtRequest" do + optional :machine, :message, 1, "hashicorp.vagrant.sdk.Ref.Machine" + end + add_message "hashicorp.vagrant.sdk.Machine.UpdatedAtResponse" do + optional :updated_at, :message, 1, "google.protobuf.Timestamp" + end + add_message "hashicorp.vagrant.sdk.Machine.UIRequest" do + optional :machine, :message, 1, "hashicorp.vagrant.sdk.Ref.Machine" + end + add_message "hashicorp.vagrant.sdk.Machine.UIResponse" do + optional :ui, :message, 1, "hashicorp.vagrant.sdk.Args.TerminalUI" + end + end +end + +module Hashicorp + module Vagrant + module Sdk + StateBag = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.StateBag").msgclass + StateBag::Value = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.StateBag.Value").msgclass + LabelSet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.LabelSet").msgclass + Options = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Options").msgclass + SSHInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.SSHInfo").msgclass + WinrmInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.WinrmInfo").msgclass + WinrmInfo::Transport = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.WinrmInfo.Transport").enummodule + MachineState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.MachineState").msgclass + MachineIndex = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.MachineIndex").msgclass + MachineIndex::Entry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.MachineIndex.Entry").msgclass + BoxCollection = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.BoxCollection").msgclass + Box = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Box").msgclass + Environment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Environment").msgclass + MachineProvider = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.MachineProvider").msgclass + Configuration = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Configuration").msgclass + Vagrantfile = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Vagrantfile").msgclass + Ref = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Ref").msgclass + Ref::Machine = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Ref.Machine").msgclass + Machine = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine").msgclass + Machine::SetNameRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.SetNameRequest").msgclass + Machine::SetNameResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.SetNameResponse").msgclass + Machine::GetNameRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.GetNameRequest").msgclass + Machine::GetNameResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.GetNameResponse").msgclass + Machine::SetIDRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.SetIDRequest").msgclass + Machine::SetIDResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.SetIDResponse").msgclass + Machine::GetIDRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.GetIDRequest").msgclass + Machine::GetIDResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.GetIDResponse").msgclass + Machine::BoxRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.BoxRequest").msgclass + Machine::BoxResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.BoxResponse").msgclass + Machine::DatadirRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.DatadirRequest").msgclass + Machine::DatadirResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.DatadirResponse").msgclass + Machine::LocalDataPathRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.LocalDataPathRequest").msgclass + Machine::LocalDataPathResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.LocalDataPathResponse").msgclass + Machine::ProviderRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.ProviderRequest").msgclass + Machine::ProviderResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.ProviderResponse").msgclass + Machine::VagrantfileNameRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.VagrantfileNameRequest").msgclass + Machine::VagrantfileNameResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.VagrantfileNameResponse").msgclass + Machine::VagrantfilePathRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.VagrantfilePathRequest").msgclass + Machine::VagrantfilePathResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.VagrantfilePathResponse").msgclass + Machine::UpdatedAtRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.UpdatedAtRequest").msgclass + Machine::UpdatedAtResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.UpdatedAtResponse").msgclass + Machine::UIRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.UIRequest").msgclass + Machine::UIResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Machine.UIResponse").msgclass + end + end +end diff --git a/plugins/commands/serve/service/proto/gen/core_services_pb.rb b/plugins/commands/serve/service/proto/gen/core_services_pb.rb new file mode 100644 index 000000000..d39f18207 --- /dev/null +++ b/plugins/commands/serve/service/proto/gen/core_services_pb.rb @@ -0,0 +1,40 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: core.proto for package 'hashicorp.vagrant.sdk' + +require 'grpc' +require 'core_pb' + +module Hashicorp + module Vagrant + module Sdk + module MachineService + # ******************************************************************* + # Machine services + # ****************************************************************** + class Service + + include GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'hashicorp.vagrant.sdk.MachineService' + + rpc :SetName, ::Hashicorp::Vagrant::Sdk::Machine::SetNameRequest, ::Hashicorp::Vagrant::Sdk::Machine::SetNameResponse + rpc :GetName, ::Hashicorp::Vagrant::Sdk::Machine::GetNameRequest, ::Hashicorp::Vagrant::Sdk::Machine::GetNameResponse + rpc :SetID, ::Hashicorp::Vagrant::Sdk::Machine::SetIDRequest, ::Hashicorp::Vagrant::Sdk::Machine::SetIDResponse + rpc :GetID, ::Hashicorp::Vagrant::Sdk::Machine::GetIDRequest, ::Hashicorp::Vagrant::Sdk::Machine::GetIDResponse + rpc :Box, ::Hashicorp::Vagrant::Sdk::Machine::BoxRequest, ::Hashicorp::Vagrant::Sdk::Machine::BoxResponse + rpc :Datadir, ::Hashicorp::Vagrant::Sdk::Machine::DatadirRequest, ::Hashicorp::Vagrant::Sdk::Machine::DatadirResponse + rpc :LocalDataPath, ::Hashicorp::Vagrant::Sdk::Machine::LocalDataPathRequest, ::Hashicorp::Vagrant::Sdk::Machine::LocalDataPathResponse + rpc :Provider, ::Hashicorp::Vagrant::Sdk::Machine::ProviderRequest, ::Hashicorp::Vagrant::Sdk::Machine::ProviderResponse + rpc :VagrantfileName, ::Hashicorp::Vagrant::Sdk::Machine::VagrantfileNameRequest, ::Hashicorp::Vagrant::Sdk::Machine::VagrantfileNameResponse + rpc :VagrantfilePath, ::Hashicorp::Vagrant::Sdk::Machine::VagrantfilePathRequest, ::Hashicorp::Vagrant::Sdk::Machine::VagrantfilePathResponse + rpc :UpdatedAt, ::Hashicorp::Vagrant::Sdk::Machine::UpdatedAtRequest, ::Hashicorp::Vagrant::Sdk::Machine::UpdatedAtResponse + rpc :UI, ::Hashicorp::Vagrant::Sdk::Machine::UIRequest, ::Hashicorp::Vagrant::Sdk::Machine::UIResponse + end + + Stub = Service.rpc_stub_class + end + end + end +end diff --git a/plugins/commands/serve/service/proto/gen/plugin_pb.rb b/plugins/commands/serve/service/proto/gen/plugin_pb.rb new file mode 100644 index 000000000..e817222e5 --- /dev/null +++ b/plugins/commands/serve/service/proto/gen/plugin_pb.rb @@ -0,0 +1,408 @@ +# 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 '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.DataDir" do + end + add_message "hashicorp.vagrant.sdk.Args.DataDir.Basis" do + optional :cache_dir, :string, 1 + optional :data_dir, :string, 2 + optional :root_dir, :string, 3 + optional :temp_dir, :string, 4 + end + add_message "hashicorp.vagrant.sdk.Args.DataDir.Project" do + optional :cache_dir, :string, 1 + optional :data_dir, :string, 2 + optional :root_dir, :string, 3 + optional :temp_dir, :string, 4 + end + add_message "hashicorp.vagrant.sdk.Args.DataDir.Machine" do + optional :cache_dir, :string, 1 + optional :data_dir, :string, 2 + optional :root_dir, :string, 3 + optional :temp_dir, :string, 4 + end + add_message "hashicorp.vagrant.sdk.Args.DataDir.Component" do + optional :cache_dir, :string, 1 + optional :data_dir, :string, 2 + optional :root_dir, :string, 3 + optional :temp_dir, :string, 4 + end + add_message "hashicorp.vagrant.sdk.Args.MachineIndex" do + end + add_message "hashicorp.vagrant.sdk.Args.MachineIndex.Entry" do + optional :id, :string, 1 + optional :local_data_path, :string, 2 + optional :name, :string, 3 + optional :provider, :string, 4 + optional :state, :string, 5 + optional :vagrantfile_name, :string, 6 + optional :vagrantfile_path, :string, 7 + optional :updated_at, :string, 8 + optional :extra_data, :message, 9, "hashicorp.vagrant.sdk.Args.Options" + end + add_message "hashicorp.vagrant.sdk.Args.BoxCollection" do + optional :directory, :string, 1 + end + add_message "hashicorp.vagrant.sdk.Args.Environment" do + optional :cwd, :string, 1 + optional :data_dir, :string, 2 + optional :vagrantfile_name, :string, 3 + optional :ui, :message, 4, "hashicorp.vagrant.sdk.Args.TerminalUI" + optional :home_path, :string, 5 + optional :local_data_path, :string, 6 + optional :tmp_path, :string, 7 + optional :aliases_path, :string, 8 + optional :boxes_path, :string, 9 + optional :gems_path, :string, 10 + optional :default_private_key_path, :string, 11 + end + add_message "hashicorp.vagrant.sdk.Args.Machine" do + optional :resource_id, :string, 1 + optional :serverAddr, :string, 2 + end + add_message "hashicorp.vagrant.sdk.Args.Configuration" do + end + add_message "hashicorp.vagrant.sdk.Args.Configuration.Vagrant" do + end + add_message "hashicorp.vagrant.sdk.Args.Configuration.VM" do + end + add_message "hashicorp.vagrant.sdk.Args.Configuration.Provider" do + end + add_message "hashicorp.vagrant.sdk.Args.LabelSet" do + map :labels, :string, :string, 1 + end + add_message "hashicorp.vagrant.sdk.Args.Options" do + optional :opt, :message, 1, "hashicorp.vagrant.sdk.Args.LabelSet" + end + add_message "hashicorp.vagrant.sdk.Args.Vagrantfile" do + 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.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.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 + add_message "hashicorp.vagrant.sdk.Provider" do + end + add_message "hashicorp.vagrant.sdk.Provider.UsableResp" do + optional :is_usable, :bool, 1 + end + add_message "hashicorp.vagrant.sdk.Provider.InstalledResp" do + optional :is_installed, :bool, 1 + end + add_message "hashicorp.vagrant.sdk.Provider.ActionResp" do + optional :result, :message, 1, "google.protobuf.Any" + map :labels, :string, :string, 2 + optional :template_data, :bytes, 3 + optional :success, :bool, 4 + end + add_message "hashicorp.vagrant.sdk.Command" do + end + add_message "hashicorp.vagrant.sdk.Command.HelpResp" do + optional :help, :string, 1 + end + add_message "hashicorp.vagrant.sdk.Command.SynopsisResp" do + optional :synopsis, :string, 1 + end + add_message "hashicorp.vagrant.sdk.Command.FlagsResp" do + optional :flags, :string, 1 + end + add_message "hashicorp.vagrant.sdk.Communicator" do + end + add_message "hashicorp.vagrant.sdk.Communicator.MatchResp" do + optional :match, :bool, 1 + end + add_message "hashicorp.vagrant.sdk.Communicator.InitResp" do + end + add_message "hashicorp.vagrant.sdk.Communicator.ReadyResp" do + optional :ready, :bool, 1 + end + add_message "hashicorp.vagrant.sdk.Communicator.FileTransferResp" do + end + add_message "hashicorp.vagrant.sdk.Communicator.ExecutionRequest" do + optional :machine, :message, 1, "hashicorp.vagrant.sdk.Args.Machine" + optional :command, :string, 2 + optional :options, :message, 3, "hashicorp.vagrant.sdk.Args.LabelSet" + end + add_message "hashicorp.vagrant.sdk.Communicator.ExecuteResp" do + optional :exit_code, :int32, 1 + end + add_message "hashicorp.vagrant.sdk.Communicator.TestResp" do + optional :valid, :bool, 1 + end + add_message "hashicorp.vagrant.sdk.Communicator.ResetResp" do + end + add_message "hashicorp.vagrant.sdk.Guest" do + end + add_message "hashicorp.vagrant.sdk.Guest.DetectResp" do + optional :detected, :bool, 1 + end + add_message "hashicorp.vagrant.sdk.Guest.Capability" do + end + add_message "hashicorp.vagrant.sdk.Guest.Capability.NamedRequest" do + optional :name, :string, 1 + optional :func_args, :message, 2, "hashicorp.vagrant.sdk.FuncSpec.Args" + end + add_message "hashicorp.vagrant.sdk.Guest.Capability.CheckResp" do + optional :has_capability, :bool, 1 + end + add_message "hashicorp.vagrant.sdk.Guest.Capability.Resp" do + optional :result, :message, 1, "google.protobuf.Any" + end + add_message "hashicorp.vagrant.sdk.Host" do + end + add_message "hashicorp.vagrant.sdk.Host.DetectResp" do + optional :detected, :bool, 1 + end + add_message "hashicorp.vagrant.sdk.Host.Capability" do + end + add_message "hashicorp.vagrant.sdk.Host.Capability.CheckResp" do + optional :has_capability, :bool, 1 + end + add_message "hashicorp.vagrant.sdk.Host.Capability.Resp" do + optional :result, :message, 1, "google.protobuf.Any" + end + end +end + +module Hashicorp + module Vagrant + module Sdk + Args = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args").msgclass + Args::DataDir = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.DataDir").msgclass + Args::DataDir::Basis = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.DataDir.Basis").msgclass + Args::DataDir::Project = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.DataDir.Project").msgclass + Args::DataDir::Machine = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.DataDir.Machine").msgclass + Args::DataDir::Component = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.DataDir.Component").msgclass + Args::MachineIndex = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.MachineIndex").msgclass + Args::MachineIndex::Entry = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.MachineIndex.Entry").msgclass + Args::BoxCollection = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.BoxCollection").msgclass + Args::Environment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.Environment").msgclass + Args::Machine = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.Machine").msgclass + Args::Configuration = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.Configuration").msgclass + Args::Configuration::Vagrant = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.Configuration.Vagrant").msgclass + Args::Configuration::VM = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.Configuration.VM").msgclass + Args::Configuration::Provider = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.Configuration.Provider").msgclass + Args::LabelSet = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.LabelSet").msgclass + Args::Options = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.Options").msgclass + Args::Vagrantfile = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.Vagrantfile").msgclass + Args::JobInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Args.JobInfo").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 + 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 + Provider = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Provider").msgclass + Provider::UsableResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Provider.UsableResp").msgclass + Provider::InstalledResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Provider.InstalledResp").msgclass + Provider::ActionResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Provider.ActionResp").msgclass + Command = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Command").msgclass + Command::HelpResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Command.HelpResp").msgclass + Command::SynopsisResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Command.SynopsisResp").msgclass + Command::FlagsResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Command.FlagsResp").msgclass + Communicator = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Communicator").msgclass + Communicator::MatchResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Communicator.MatchResp").msgclass + Communicator::InitResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Communicator.InitResp").msgclass + Communicator::ReadyResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Communicator.ReadyResp").msgclass + Communicator::FileTransferResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Communicator.FileTransferResp").msgclass + Communicator::ExecutionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Communicator.ExecutionRequest").msgclass + Communicator::ExecuteResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Communicator.ExecuteResp").msgclass + Communicator::TestResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Communicator.TestResp").msgclass + Communicator::ResetResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Communicator.ResetResp").msgclass + Guest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Guest").msgclass + Guest::DetectResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Guest.DetectResp").msgclass + Guest::Capability = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Guest.Capability").msgclass + Guest::Capability::NamedRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Guest.Capability.NamedRequest").msgclass + Guest::Capability::CheckResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Guest.Capability.CheckResp").msgclass + Guest::Capability::Resp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Guest.Capability.Resp").msgclass + Host = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Host").msgclass + Host::DetectResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Host.DetectResp").msgclass + Host::Capability = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Host.Capability").msgclass + Host::Capability::CheckResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Host.Capability.CheckResp").msgclass + Host::Capability::Resp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("hashicorp.vagrant.sdk.Host.Capability.Resp").msgclass + end + end +end diff --git a/plugins/commands/serve/service/proto/gen/plugin_services_pb.rb b/plugins/commands/serve/service/proto/gen/plugin_services_pb.rb new file mode 100644 index 000000000..e28979ab2 --- /dev/null +++ b/plugins/commands/serve/service/proto/gen/plugin_services_pb.rb @@ -0,0 +1,264 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: plugin.proto for package 'hashicorp.vagrant.sdk' + +require 'grpc' +require '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 ProviderService + # service CommunicatorService { + # rpc Match(Communicator.MatchRequest) returns (Communicator); + # } + # + # ******************************************************************* + # 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.ProviderService' + + # rpc Usable(google.protobuf.Empty) returns (Provider.UsableResp); + # rpc Installed(google.protobuf.Empty) returns (Provider.InstalledResp); + rpc :Usable, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Provider::UsableResp + rpc :UsableSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + rpc :Installed, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Provider::InstalledResp + rpc :InstalledSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + rpc :Init, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Google::Protobuf::Empty + rpc :InitSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + rpc :ActionUp, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Provider::ActionResp + rpc :ActionUpSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + # rpc ActionHalt(FuncSpec.Args) returns (Provider.Action.Resp); + # rpc ActionHaltSpec(google.protobuf.Empty) returns (FuncSpec); + # rpc ActionSuspend(FuncSpec.Args) returns (Provider.Action.Resp); + # rpc ActionSuspendSpec(google.protobuf.Empty) returns (FuncSpec); + # rpc ActionReload(FuncSpec.Args) returns (Provider.Action.Resp); + # rpc ActionReloadSpec(google.protobuf.Empty) returns (FuncSpec); + # rpc ActionResume(FuncSpec.Args) returns (Provider.Action.Resp); + # rpc ActionResumeSpec(google.protobuf.Empty) returns (FuncSpec); + # rpc ActionProvision(FuncSpec.Args) returns (Provider.Action.Resp); + # rpc ActionProvisionSpec(google.protobuf.Empty) returns (FuncSpec); + # rpc ActionSnapshotSave(FuncSpec.Args) returns (Provider.Action.Resp); + # rpc ActionSnapshotSaveSpec(google.protobuf.Empty) returns (FuncSpec); + # rpc ActionSnapshotRestore(FuncSpec.Args) returns (Provider.Action.Resp); + # rpc ActionSnapshotRestoreSpec(google.protobuf.Empty) returns (FuncSpec); + # rpc ActionSnapshotDelete(FuncSpec.Args) returns (Provider.Action.Resp); + # rpc ActionSnapshotDeleteSpec(google.protobuf.Empty) returns (FuncSpec); + # rpc ActionDestroy(FuncSpec.Args) returns (Provider.Action.Resp); + # rpc ActionDestroySpec(google.protobuf.Empty) returns (FuncSpec); + 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 + # 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); + module ProvisionerService + # ******************************************************************* + # 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.ProvisionerService' + + 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 CommandService + class Service + + include GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'hashicorp.vagrant.sdk.CommandService' + + 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 + rpc :SynopsisSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + rpc :Synopsis, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Command::SynopsisResp + rpc :HelpSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + rpc :Help, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Command::HelpResp + rpc :FlagsSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + rpc :Flags, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Command::FlagsResp + end + + Stub = Service.rpc_stub_class + end + module CommunicatorService + class Service + + include GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'hashicorp.vagrant.sdk.CommunicatorService' + + 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 + rpc :MatchSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + rpc :Match, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Communicator::MatchResp + rpc :InitSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + rpc :Init, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Communicator::InitResp + rpc :ReadySpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + rpc :Ready, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Communicator::ReadyResp + rpc :WaitForReadySpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + rpc :WaitForReady, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Communicator::ReadyResp + rpc :DownloadSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + rpc :Download, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Communicator::FileTransferResp + rpc :UploadSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + rpc :Upload, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Communicator::FileTransferResp + rpc :ExecuteSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + rpc :Execute, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Communicator::ExecuteResp + rpc :PrivilegedExecuteSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + rpc :PrivilegedExecute, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Communicator::ExecuteResp + rpc :TestSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + rpc :Test, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Communicator::TestResp + rpc :ResetSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + rpc :Reset, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Communicator::ResetResp + end + + Stub = Service.rpc_stub_class + end + module ConfigService + class Service + + include GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'hashicorp.vagrant.sdk.ConfigService' + + 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 GuestService + class Service + + include GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'hashicorp.vagrant.sdk.GuestService' + + 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 + rpc :Detect, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Guest::DetectResp + rpc :DetectSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + rpc :HasCapability, ::Hashicorp::Vagrant::Sdk::Guest::Capability::NamedRequest, ::Hashicorp::Vagrant::Sdk::Guest::Capability::CheckResp + rpc :HasCapabilitySpec, ::Hashicorp::Vagrant::Sdk::Guest::Capability::NamedRequest, ::Hashicorp::Vagrant::Sdk::FuncSpec + rpc :Capability, ::Hashicorp::Vagrant::Sdk::Guest::Capability::NamedRequest, ::Hashicorp::Vagrant::Sdk::Guest::Capability::Resp + rpc :CapabilitySpec, ::Hashicorp::Vagrant::Sdk::Guest::Capability::NamedRequest, ::Hashicorp::Vagrant::Sdk::FuncSpec + end + + Stub = Service.rpc_stub_class + end + module HostService + class Service + + include GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'hashicorp.vagrant.sdk.HostService' + + 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 + rpc :Detect, ::Hashicorp::Vagrant::Sdk::FuncSpec::Args, ::Hashicorp::Vagrant::Sdk::Host::DetectResp + rpc :DetectSpec, ::Google::Protobuf::Empty, ::Hashicorp::Vagrant::Sdk::FuncSpec + end + + Stub = Service.rpc_stub_class + end + module SyncedFolderService + class Service + + include GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'hashicorp.vagrant.sdk.SyncedFolderService' + + 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/plugins/commands/serve/service/proto/gen/protostructure_pb.rb b/plugins/commands/serve/service/proto/gen/protostructure_pb.rb new file mode 100644 index 000000000..9b2a9c0c1 --- /dev/null +++ b/plugins/commands/serve/service/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