Setup machine client

This commit is contained in:
sophia 2021-01-07 11:33:14 -06:00 committed by Paul Hinze
parent fdcae6e13a
commit 82e3dd55ad
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
2 changed files with 36 additions and 0 deletions

View File

@ -7,6 +7,36 @@ require "thread"
require "log4r"
module Vagrant
# This is the client that does CRUD operations against
# the core Vagrant service
class MachineClient
attr_accessor :broker
def initialize(client_connection, broker)
# TODO instantiate a new machine client
@client = nil # todo
@broker = broker
end
# Get a machine by id
#
# @param [String] machine id
# @return [Machine]
def get_machine(id)
end
# Update/insert a machine
#
# @param [Machine] machine to upsert
# @return [Machine] the final state of the machine
def upsert_machine(machine)
end
end
# This represents a machine that Vagrant manages. This provides a singular
# API for querying the state and making state changes to the machine, which
# is backed by any sort of provider (VirtualBox, VMware, etc.).

View File

@ -35,10 +35,16 @@ module VagrantPlugins
def action_up(req, _unused_call)
LOG.debug("action up")
# TODO: deserialize request
# [<Hashicorp::Vagrant::Sdk::FuncSpec::Value: name: "", type: "hashicorp.vagrant.sdk.Args.Machine", value: <Google::Protobuf::Any: type_url: "type.googleapis.com/hashicorp.vagrant.sdk.Args.Machine", value: "\n\rmytestmachine\x12\x0F127.0.0.1:49505">>]
LOG.debug(req)
nil
end
def machine_arg_to_machine(req)
end
def action_up_spec(req, _unused_call)
LOG.debug("action up spec")
args = [