Add provider service
This commit is contained in:
parent
8cccefb8aa
commit
6d397a072d
@ -1,4 +1,6 @@
|
||||
require_relative "./service/plugin_service"
|
||||
require_relative "./service/provider_service"
|
||||
|
||||
require "optparse"
|
||||
require 'grpc'
|
||||
require 'grpc/health/checker'
|
||||
@ -43,7 +45,9 @@ module VagrantPlugins
|
||||
s.add_http2_port("[::]:#{port}", :this_port_is_insecure)
|
||||
|
||||
s.handle(VagrantPlugins::CommandServe::Serve::PluginService.new)
|
||||
|
||||
s.handle(VagrantPlugins::CommandServe::Serve::ProviderService.new)
|
||||
|
||||
|
||||
health_checker = Grpc::Health::Checker.new
|
||||
health_checker.add_status(
|
||||
"Service::PluginService",
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# Source: core.proto for package 'hashicorp.vagrant.sdk'
|
||||
|
||||
require 'grpc'
|
||||
require 'core_pb'
|
||||
require_relative './core_pb'
|
||||
|
||||
module Hashicorp
|
||||
module Vagrant
|
||||
|
||||
@ -6,8 +6,8 @@ require 'google/protobuf'
|
||||
require 'google/protobuf/any_pb'
|
||||
require 'google/protobuf/empty_pb'
|
||||
require 'google/rpc/status_pb'
|
||||
require 'protostructure_pb'
|
||||
require 'core_pb'
|
||||
require_relative './protostructure_pb'
|
||||
require_relative './core_pb'
|
||||
Google::Protobuf::DescriptorPool.generated_pool.build do
|
||||
add_file("plugin.proto", :syntax => :proto3) do
|
||||
add_message "hashicorp.vagrant.sdk.Args" do
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# Source: plugin.proto for package 'hashicorp.vagrant.sdk'
|
||||
|
||||
require 'grpc'
|
||||
require 'plugin_pb'
|
||||
require_relative './plugin_pb'
|
||||
|
||||
module Hashicorp
|
||||
module Vagrant
|
||||
|
||||
@ -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
|
||||
43
plugins/commands/serve/service/provider_service.rb
Normal file
43
plugins/commands/serve/service/provider_service.rb
Normal file
@ -0,0 +1,43 @@
|
||||
|
||||
require_relative 'proto/gen/plugin/plugin_pb'
|
||||
require_relative 'proto/gen/plugin/plugin_services_pb'
|
||||
|
||||
module VagrantPlugins
|
||||
module CommandServe
|
||||
module Serve
|
||||
class ProviderService < Hashicorp::Vagrant::Sdk::ProviderService::Service
|
||||
def usable(req, _unused_call)
|
||||
nil
|
||||
end
|
||||
|
||||
def usable_spec(req, _unused_call)
|
||||
nil
|
||||
end
|
||||
|
||||
def installed(req, _unused_call)
|
||||
nil
|
||||
end
|
||||
|
||||
def installed_spec(req, _unused_call)
|
||||
nil
|
||||
end
|
||||
|
||||
def init(req, _unused_call)
|
||||
nil
|
||||
end
|
||||
|
||||
def init_spec(req, _unused_call)
|
||||
nil
|
||||
end
|
||||
|
||||
def action_up(req, _unused_call)
|
||||
nil
|
||||
end
|
||||
|
||||
def action_up_spec(req, _unused_call)
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user